开发者社区> 问答> 正文

《实用common lisp编程》中问题求教? 400 报错

《实用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]


展开
收起
爱吃鱼的程序员 2020-06-05 13:20:06 414 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    函数没编译, 把光标放在这个函数定义内, C-c C-c 就可以了

    2020-06-05 13:20:17
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Concurrency in Rust 立即下载
Python 脚本速查手册 立即下载
Improving Python and Spark Per 立即下载