1

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

4

1 回答 1

3

您需要使用引号字符撇号: '。你没有。您使用了正确的引号。

于 2012-03-17T03:41:08.897 回答