我从鸡肉计划开始。下面的代码适用于 mit-scheme repl,但不适用于 csi。 csi 在文档中定义了过滤器,但是当我运行下面的代码时出现未绑定(bind)变量错误。
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>
最佳答案
filter
在 the srfi-1
module 中定义,因此您必须首先加载该模块以使其可用:
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>
关于在鸡计划中过滤未绑定(bind)。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32431241/