novice question about QUOTE and LIST
Posted: Wed Mar 06, 2013 12:05 pm
The following sequence of entries and results make sense to me up until the last one:
Why didn't the last one return "(QUOTE 1)"?
My guess was maybe Lisp tries to evaluate the list if the first parameter is a function, macro, or special form, so I tried this:
Can someone explain to me why (list 'quote 1) is treated differently and how it produces '1?
Code: Select all
>>(list 1 2 3 'quote 4 5 6)
(1 2 3 QUOTE 4 5 6)
>>(list 1 2 3 'quote )
(1 2 3 QUOTE)
>>(list 'quote 4 5 6)
(QUOTE 4 5 6)
>>(list 1 'quote)
(1 QUOTE)
>>(list 'quote 1)
'1
My guess was maybe Lisp tries to evaluate the list if the first parameter is a function, macro, or special form, so I tried this:
Code: Select all
>>(list 'setq 'x 5)
(SETQ X 5)
>>(list '+ 1 2)
(+ 1 2)
>>(list 'if t 1 2)
(IF T 1 2)