[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Basic Emacs Lisp question
From: |
Tim X |
Subject: |
Re: Basic Emacs Lisp question |
Date: |
Wed, 30 Apr 2008 18:31:23 +1000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
tyler <tyler.smith@mail.mcgill.ca> writes:
> Matthias Pfeifer <pfemat@web.de> writes:
>
>> What is the difference between
>>
>> (list 0 nil -1)
>>
>> and
>>
>> '(0 nil -1)
>>
>
> In this instance, nothing. However, the '(...) form leaves it's
> arguments unevaluated (quoted), while (list ...) evaluates them. Since
> 0, nil and -1 all evaluate to themselves there is no difference in this
> case. However, the following two statements are different:
>
> (list 0 fill-column -1)
>
> '(0 fill-column -1)
>
> A good place to start learning is the Introduction to Programming in
> Emacs Lisp, which is available from gnu.org, if it isn't already present
> in your info directory (i.e., C-h i m emacs lisp intro <ret>).
>
Are you sure there is no difference? In many lisp dialects, the second
form is more like a constant and cannot be modified in a reliable
manner - IIRC this is due to how memory is allocated for the
quoted form. In the first one, memory is allocated dynamically and so
can be safely modified.
Tim
--
tcross (at) rapttech dot com dot au