help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a list


From: David Kastrup
Subject: Re: Creating a list
Date: Thu, 19 Nov 2009 14:57:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Cecil Westerhof <Cecil@decebal.nl> writes:

> David Kastrup <dak@gnu.org> writes:
>
>>>>> At the moment I create a list with:
>>>>>       (setq ret-val (cons total-amount (cons current-amount ())))
>>>>> I thought about doing it with:
>>>>>       (setq ret-val (cons total-amount '(current-amount)))
>>>>>
>>>>> But then the second value is the string current-amount
>>>>
>>>> Wrong.  The _symbol_ current-amount.
>>>
>>> When evaluating I got:
>>>     (1570378.2570192777 current-amount)
>>> That is why I thought I got the string.
>>
>> A string would have quote marks around it.
>
> Off course.
>
> But I have a few questions on my mind.
> - Why is the first shown as value and the second as _symbol_?

Because you quoted the entire list containing the second value.

> - current-amount is a local variable. How is it possible that the symbol
>   is still defined?

I really recommend that you read a Lisp introduction.  Your questions
are very very basic.

A symbol, like a plain unquoted list, _is_ a valid expression all by
itself.  In the context of evaluation, a further interpretation tries
going from there (fetching a symbol's value, calling the first element
of a list as a function on the rest).  But whether or not you can
usefully call eval on it, either are printable and useful expressions.

-- 
David Kastrup


reply via email to

[Prev in Thread] Current Thread [Next in Thread]