我在我的fedora-13機器上安裝了clisp。在CLISP解釋,我已經進入了以下內容:common lisp - ch 02,代碼錯誤?
(defun ask-num()
(format t "Please enter a number.")
(let ((val (read)))
(if (numberp val)
val
(ask-num))))
下面是保羅·格雷厄姆的書的原代碼:
(defun ask-number()
(format t "Please enter a number. ")
(let ((val (read)))
(if (numberp val)
val
(ask-number))))
是有什麼我已經錯過了?這看起來更像是解釋者的特質,而不是代碼中的錯誤。 Here是鏈接。您可能需要按Ctrl-F查看相關代碼。
更新:哈哈,對...問題!
[9]> (defun ask-num()
(format t "Please enter a number.")
(let ((val (read)))
(if (numberp val)
val
(ask-num))))
ASK-NUM
[10]> ask-num
*** - SYSTEM::READ-EVAL-PRINT: variable ASK-NUM has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of ASK-NUM.
STORE-VALUE :R2 Input a new value for ASK-NUM.
ABORT :R3 Abort main loop
有你錯過了什麼?是的,這是你遇到的真正的_problem_ :-)這段代碼在我的Ubuntu clisp上工作得很好。 – paxdiablo 2011-05-31 02:57:03