all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* associative list won't append variable contents
@ 2006-01-31  5:18 Dr. Shred
  2006-01-31 10:31 ` David Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Dr. Shred @ 2006-01-31  5:18 UTC (permalink / raw)


Hi,

(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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: associative list won't append variable contents
  2006-01-31  5:18 associative list won't append variable contents Dr. Shred
@ 2006-01-31 10:31 ` David Hansen
  2006-02-14  5:19   ` Dr. Shred
  0 siblings, 1 reply; 4+ messages in thread
From: David Hansen @ 2006-01-31 10:31 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: associative list won't append variable contents
  2006-01-31 10:31 ` David Hansen
@ 2006-02-14  5:19   ` Dr. Shred
  2006-02-14  9:42     ` Peter Dyballa
  0 siblings, 1 reply; 4+ messages in thread
From: Dr. Shred @ 2006-02-14  5:19 UTC (permalink / raw)


It worked.  Thanks!  I couldn't find this info in the emacs
manual.  Is there some good documentation available for
emacs lisp?


David Hansen wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: associative list won't append variable contents
  2006-02-14  5:19   ` Dr. Shred
@ 2006-02-14  9:42     ` Peter Dyballa
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2006-02-14  9:42 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 14.02.2006 um 05:19 schrieb Dr. Shred:

> Is there some good documentation available for emacs lisp?

How is that: http://www.gnu.org/software/emacs/elisp-manual/elisp.html?

--
Greeting

   Pete

Without vi there is only GNU Emacs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-14  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-31  5:18 associative list won't append variable contents Dr. Shred
2006-01-31 10:31 ` David Hansen
2006-02-14  5:19   ` Dr. Shred
2006-02-14  9:42     ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.