我正在尝试开始使用 Lisp,并且我有一些(凌乱的)代码,我希望能够向用户询问标题和网址。
将它们保存在一个变量中,然后在调用时将它们打印出来。我遇到了麻烦。首先我不知道如何编译我的程序来运行它。另外,有一次我运行它时,我收到一个关于变量标题未被调用的错误。任何人都可以帮助我解决这些问题吗?抱歉,我无法为您提供有关该错误的更多信息。
;;Define a function called make-cd that takes four parameters
(defun make-url( title url ))
(list :title title :url url)
;;In the make-url function create a plist that takes the passed values
;; Define global variable db and set its value to nil
(defvar *db* nil)
;; Define a function that takes one paramter and pushes it to the make-url func.
;;(defun add-url (url) (push url *db*))
;; Define a function that takes the *db* variable and makes the output pretty
(defun dump-db ()
(dolist (url *db*)
(format t "~{~a:~10t~a~%~}~%" url)))
(defun prompt-read (prompt)
(format *query-io* "~a: " prompt)
(force-output *query-io*)
(read-line *query-io*))