Search code examples
common-lispclisp

Sample code in Touretzky's book causes Error at Let*


Sample code in page 144 of Touretzky's Lisp book causes error on my environment. Is anything wrong with how I run?

(defun price-change (old new)
  (let* ((diff (- new old))
     (proportion (/ diff old))
     (percentage (* proportion 100.0)))
    (list ’widgets ’changed ’by percentage
       ’percent))
)

Here's the error. I don't understand why string "widgets" is evaluated...

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

Environment: Ubuntu 11.10, GNU CLISP 2.49


Solution

  • You need to use the quote character apostrophe: '. You did not. You have used a right quotation mark.