为什么lisp说这个函数是未定义的?

时间:2013-10-21 02:06:20

标签: lisp common-lisp

我在源缓冲区中写这个:

 (defun make-cd (artist album rating like) 
  (list :artist artist :album album :score rating :like like))
(defvar *dab* nil)
(defun addcd (cd) (push cd *dab*))
(defun readab ()
  (dolist (cd *dab*)
    (format t "~{~10t~a--~5t~a~%~}~%" cd)))

按C-c C-k编译进入REPL。

前几个函数在REPL中运行良好:

CL-USER> (make-cd "dixie" "fun time" 6 "y")
 (:ARTIST "dixie" :ALBUM "fun time" :SCORE 6 :LIKE "y")
CL-USER> (addcd (make-cd "dixie" "whooola" 6 "y"))
 ((:ARTIST "dixie" :ALBUM "whooola" :SCORE 6 :LIKE "y"))

但最后报道为未定义?

CL-USER> (readab)
  ; Evaluation aborted on #<CCL::UNDEFINED-FUNCTION-CALL #x302000B3895D>.

我错过了一些非常明显的东西吗?

1 个答案:

答案 0 :(得分:1)

问题是由于C-c C-k命令在处理之前没有自动保存源,因此处理发生在源的旧保存上。先保存,问题就消失了。