Touretzky 的Lisp
书第 144 页中的示例代码导致我的环境出错。我的跑步方式有什么问题吗?
(defun price-change (old new)
(let* ((diff (- new old))
(proportion (/ diff old))
(percentage (* proportion 100.0)))
(list ’widgets ’changed ’by percentage
’percent))
)
这是错误。我不明白为什么要评估字符串“小部件”...
Break 5 [7]> (price-change 1.25 1.35)
*** - LET*: variable ’WIDGETS has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of ’WIDGETS.
STORE-VALUE :R2 Input a new value for ’WIDGETS.
ABORT :R3 Abort debug loop
ABORT :R4 Abort debug loop
ABORT :R5 Abort debug loop
ABORT :R6 Abort debug loop
ABORT :R7 Abort debug loop
ABORT :R8 Abort main loop
环境:Ubuntu 11.10、GNU CLISP 2.49