4

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>
Brian Yeh
  • 3,119
  • 3
  • 26
  • 40

2 Answers2

4

Not sure which filter procedure you are referring but it seems one of the filter listed on the doc is only available during macro expansions:

http://api.call-cc.org/doc/bindings#sec:filter

The one you can use in runtime is defined in SRFI-1 library. To use it, you can simply add the following:

(use srfi-1)

Takashi Kato
  • 646
  • 3
  • 5
4

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>
sjamaan
  • 2,282
  • 10
  • 19