質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top