加载以下 2 个函数clisp
就成功了。
(defun func1 (l)
(defvar *count* nil)
(setq count 1)
(cond ((null l) 0)
((atom l) (+ count 1))
((atom (car l)) (+ count (func1 (cdr l))))
((listp (car l)) (+ (func1 (car l)) (func1 (cdr l))))
(t nil)) )
(defun func2 (l)
(defvar *resLis* nil)
(setq resLis '((0 0)))
(anotherFunc l resLis)
)
但是,sbcl
会导致错误:
warning: undefined variable: COUNT
warning: undefined variable: RESLIS
Compilation failed.
我更喜欢使用sbcl
(因为我slime
只使用它)但是上面的代码有什么问题?
环境:Ubuntu 11.10、GNU CLISP 2.49、SBCL 1.0.50.0.debian