From: Ronald
Subject: Any different? '(1 2) (list 1 2)
Date: 
Message-ID: <emqdfr$81a$1@news.yaako.com>
Any different? '(1 2) (list 1 2) 

From: ·····@evins.net
Subject: Re: Any different? '(1 2) (list 1 2)
Date: 
Message-ID: <1167113671.630067.297140@73g2000cwn.googlegroups.com>
Ronald wrote:
> Any different? '(1 2) (list 1 2)

'(1 2) is the same as (quote (1 2)); it returns a literal list, created
at compile time.

(list 1 2) is an expression that can create a new list each time it's
evaluated.

It's similar to the difference between a literal string:

"foobar"

and a piece of code (in any language) that allocates a string and
stuffs the characters 'f' 'o' 'o  'b' 'a' 'r' into it.
From: Sam Steingold
Subject: Re: Any different? '(1 2) (list 1 2)
Date: 
Message-ID: <m3wt4fgppn.fsf@loiso.podval.org>
> * Ronald <·········@163.pbz> [2006-12-26 13:55:03 +0800]:
>
> Any different? '(1 2) (list 1 2) 

'(1 2) is a literal object, created once.
(list 1 2) is a function call, it returns a fresh (newly allocated) list
on each invocation.

(equal '(1 2) (list 1 2)) ==> T

(defun f () '(1 2))
(eq (f) (f)) ==> T

(defun g () (list 1 2))
(eq (g) (g)) ==> NIL
(equal (g) (g)) ==> T

you should _never_ modify literal objects,
see http://clisp.cons.org/impnotes/faq.html#faq-self-mod

-- 
Sam Steingold (http://sds.podval.org/) on Fedora Core release 6 (Zod)
http://memri.org http://israelunderattack.slide.com http://camera.org
http://jihadwatch.org http://ffii.org http://honestreporting.com
Programming is like sex: one mistake and you have to support it for a lifetime.