Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'(a b c) and (list a b c)

4 views
Skip to first unread message

John Somerville

unread,
Dec 13, 1996, 3:00:00 AM12/13/96
to

Are these identical in Common Lisp? I had thought so, however in
XLisp-Stat they are not for some functions.

For example for (spin-plot '( a b c)) does not work in XLisp-Stat whereas
(spin-plot (list a b c)) does. If I substitute '+' for 'spin-plot'
the function performs properly. Is that right? If it is, how do I
examine the two different data structures, i.e. what function do I use
to see their internal representation.

Erik Naggum

unread,
Dec 13, 1996, 3:00:00 AM12/13/96
to

* John Somerville

| Are these identical in Common Lisp?

no. '(a b c) is identical to (quote (a b c)), which evaluates to (a b c),
a list of the three symbols a, b, and c. (list a b c) evaluates to a list
of the values of the symbols a, b, and c, and thus depends on the value of
a, b, and c, at the time of the call.

e.g.,

(let ((a 1)
(b 2)
(c 3))
(print '(a b c))
(print (list a b c))
(values))

prints

(A B C)
(1 2 3)

I didn't understand your second question.

#\Erik
--
Please address private replies, only, to "erik". Junk mail, spam,
stupid flames, courtesy copies, etc, should be sent to "nobody".

William Paul Vrotney

unread,
Dec 13, 1996, 3:00:00 AM12/13/96
to

If 'spin-plot' is a function then they will both be evaluated to the same
internal structure. That's why the '+' works because '+' is a function. If
'spin-plot' is a macro then it depends on how the macro treats that argument.
That is, if 'spin-plot' is a macro it would see

(spin-plot (quote (a b c)))

versus

(spin-plot (list a b c))

which are two very different things if the macro decides to not evaluate
them and does some strange thing with the constant list argument. You can
test if 'spin-plot' is a macro by typing

(macro-function 'spin-plot)

if it returns non-NIL then 'spin-plot' is a macro and may explain the strange
behavior.


--

William P. Vrotney - vro...@netcom.com

0 new messages