"In Lisp": `(abc) vs '(abc) vs (list' a 'b' c)

In On Lisp (p. 84) Graham says

‘(a b c)

(no comma) equals ’(a b c)


and then says

A countdown list is equivalent to calling a list with quot. That is, ‘(a b c)

(no comma) equals (list ’a ’b ’c)

.

One operator must be false, since '(a b c)

both (list 'a 'b 'c)

do not appear to be equal. The latter is a freshly linked list (safe to modify), while the former is a constant - or at least the spec allows the compiler to treat it as such.

So maybe this is a very frustrating question, but is it a reverse-write list (no comma) such as ‘(a b c)

equal '(a b c)

or equal (list 'a 'b 'c)

?

+3


source to share


1 answer


Equal and Equivalent are not the same.



Of course (equal '(a b c) (list 'a 'b 'c))

back t

, but, as you rightly pointed out, '(a b c)

- it is a constant with the quotes, and (list 'a 'b 'c)

just highlighted.

+6


source







All Articles