0
我寫這在源緩衝器: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)))
予編譯成REPL按C-C C-K。
前幾個函數就可以從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>.
我是否錯過了一些非常明顯的東西?
wfm in clisp - 沒有錯誤,輸出如預期。請嘗試調試器。 – sds
您的原始代碼適用於我。也許有什麼事情與包?嘗試將'(in-package:cl-user)'添加到源緩衝區的開頭,以確保... – jlahd