1

I begin to learn newlisp, but the quote and ' puzzle me.

> (= '(quote 1) ''1)  
nil

or

> (first (quote (quote 1)))  
quote

> (first ''1)  
ERR: array, list or string expected in function first : ''1

in newlisp, quote is different from ' ?
or, this is a bug?

cormullion
  • 1,672
  • 1
  • 10
  • 24
skeu
  • 25
  • 3

1 Answers1

1

There is a subtle difference between the two. The single quote is resolved during source code translation, when the quoted cell is wrapped into a protecting envelope. The function quote does the same but during evaluation. For most purposes they behave in the same way.

So the function quote is more like the original Lisp quote. The ' is an optimization performed during code translation. If you want to know more about code translation and evaluation, compare the functions read-expr and eval-string.

cormullion
  • 1,672
  • 1
  • 10
  • 24
  • I read the newlisp's source, the **quote** is translated as a SYMBOL, but **'** is translated as a QUOTE. I do the same thing, CL and Schme can return the quote, `(car ''a)` so, why newlisp do this? – skeu Dec 24 '13 at 01:31
  • There are many differences between Lisps... :) As for "why", your best bet might be to email the author of newLISP or ask at the newLISP forum. – cormullion Dec 24 '13 at 08:27