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

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

Re: associative list won't append variable contents


From: David Hansen
Subject: Re: associative list won't append variable contents
Date: Tue, 31 Jan 2006 11:31:52 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On Tue, 31 Jan 2006 05:18:25 GMT Shred wrote:

> (setq car-0 foo-0)
> (setq cdr-0 foo-1)
> (setq file-list (append '((car-0 . cdr-0)) file-list))
>
> I want the contents of car-0 and cdr-0 to be the actual
> car and cdr.
>
> Lisp creates
>
> ((car-0 . cdr-0))
>
> not
>
> ((foo-0 . foo-1))
>
> Shouldn't this work?

The `quote' inhibits all evaluation.  Either use the
`list'and `cons' function

(append (list (cons car-0 cdr-0)) file-list)

or the IMHO easier to read `backquote' (C-h f backquote RET
for more information):

(append `((,car-0 . ,cdr-0)) file-list)

David


reply via email to

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