Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

filter unbound in chicken scheme. Why?

I'm starting out with chicken scheme. The code below works in the mit-scheme repl but doesn't with csi. csi has filter defined in the docs but I get an unbound variable error when I run the code below.

    CHICKEN
(c) 2008-2015, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.10.0 (rev b259631)
macosx-unix-clang-x86-64 [ 64bit manyargs dload ptables ]
compiled 2015-08-04 on yves.more-magic.net (Linux)

#;1> (filter odd? '(1 2 3 ))

Error: unbound variable: filter

    Call history:

    <syntax>          (filter odd? (quote (1 2 3)))
    <syntax>          (quote (1 2 3))
    <syntax>          (##core#quote (1 2 3))
    <eval>    (filter odd? (quote (1 2 3))) <--
#;1>
like image 766
Brian Yeh Avatar asked Feb 10 '23 02:02

Brian Yeh


1 Answers

filter is defined in the srfi-1 module, so you must first load that module to make it available:

CHICKEN
(c) 2008-2014, The Chicken Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
bootstrapped 2014-06-07

#;1> (use srfi-1)
; loading /var/lib//chicken/7/srfi-1.import.so ...
; loading library srfi-1 ...
#;2> (filter odd? '(1 2 3 ))
(1 3)
#;3>
like image 170
sjamaan Avatar answered Feb 28 '23 10:02

sjamaan