Code: Select all
> (println (= ''x '(quote x)))
nil
Code: Select all
> (println (= ''x '(quote x)))
nil
Code: Select all
> (= 'x (quote x))
true
> (= ''x '(quote x))
nil
>
> (= ''x (quote 'x))
true
>
Code: Select all
>(list? '(quote x))
true
Code: Select all
newLISP v.9.3.11 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.
> (= 'x (quote x))
true
> (= ''x '(quote x))
nil
> (quote x)
x
> '(quote x)
(quote x)
> (quote (quote x))
(quote x)
> 'x
x
> ''x
'x
Code: Select all
Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
> (equal? 'x (quote x))
#t
> (equal? ''x '(quote x))
#t
> (quote x)
x
> '(quote x)
(quote x)
> (quote (quote x))
(quote x)
> 'x
x
> ''x
(quote x)
Code: Select all
This is SBCL 1.0.6, an implementation of ANSI Common Lisp.
* (equal 'x (quote x))
T
* (equal ''x '(quote x))
T
* (quote x)
X
* '(quote x)
'X
* (quote (quote x))
'X
* 'x
X
* ''x
'X
Code: Select all
newLISP v.9.3.11 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.
> (quote? ''x)
true
> (quote? '(quote x))
nil
> (list? '(quote x))
true
Yes, as long as we bear in mind that anything we type in the REPL is subject to one round of evaluation.Kazimir Majorinc wrote:It seems that (quote <expr>) has advantages, because it is list, and it can be analyzed, while '<expr> is not a list, and it must be evaluated first, to get rid of quote and then analyzed. Is it right?
No -- there is no other advantage that I can see.Kazimir Majorinc wrote:Is there any advantage of ' (except it is shorter?)
Its also more than double as fast to process, because it gets pre-compiled during load/read.Kazimir wrote:Is there any advantage of ' (except it is shorter?)
Code: Select all
> (time 'x 1000000)
25
> (time (quote x) 1000000)
65
>