《实用common lisp编程》中问题求教? 400 报错
我用的win7系统,lispbox开发环境。在调试书上第三章,“保存和加载数据库”小节的代码上遇到了问题。求指教.代码如下:
(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]
函数没编译, 把光标放在这个函数定义内, C-c C-c 就可以了
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。