level 3
贴吧用户_0J17DXK
楼主
我用的win7系统,
lispbox-0.7
我在看第三章:简单数据库的时候,按照书上的代码写的程序:
(defvar *db* nil)
(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))
(defun add-record (cd) (push cd *db*))
(defun dump-db()
(dolist (cd *db*)
(format t "~{~a: ~10t~a~%~}~%" cd)))
(defun prompt-read (prompt)
(format *query-io* "~a: " prompt)
(force-output *query-io*)(read-line *query-io*))
(defun prompt-for-cd()
(make-cd(prompt-read "Title")
(prompt-read "Artist")
(or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
(y-or-n-p "Ripped [Y/n]")))
(defun add-cds ()
(loop (add-record (prompt-for-cd))
(if (not (y-or-n-p "Another? [y/n]: ")) (return))))
(defun save-db (filename)
(with-open-file (out filename :direction :output :if-exists :supersede)
(with-standard-io-syntax(print *db* out))))
在调用最后一个函数save-db的时候,出错了,错误信息如下:
Undefined function SAVE-DB called with arguments ("f:/lispCode/make-cd.dat") . [Condition of type CCL::UNDEFINED-FUNCTION-CALL]
跪求同学们指教啊
2013年08月02日 15点08分
1
lispbox-0.7
我在看第三章:简单数据库的时候,按照书上的代码写的程序:
(defvar *db* nil)
(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))
(defun add-record (cd) (push cd *db*))
(defun dump-db()
(dolist (cd *db*)
(format t "~{~a: ~10t~a~%~}~%" cd)))
(defun prompt-read (prompt)
(format *query-io* "~a: " prompt)
(force-output *query-io*)(read-line *query-io*))
(defun prompt-for-cd()
(make-cd(prompt-read "Title")
(prompt-read "Artist")
(or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
(y-or-n-p "Ripped [Y/n]")))
(defun add-cds ()
(loop (add-record (prompt-for-cd))
(if (not (y-or-n-p "Another? [y/n]: ")) (return))))
(defun save-db (filename)
(with-open-file (out filename :direction :output :if-exists :supersede)
(with-standard-io-syntax(print *db* out))))
在调用最后一个函数save-db的时候,出错了,错误信息如下:
Undefined function SAVE-DB called with arguments ("f:/lispCode/make-cd.dat") . [Condition of type CCL::UNDEFINED-FUNCTION-CALL]
跪求同学们指教啊