all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Adding many elements to a list
@ 2009-09-18 13:15 Nordlöw
  2009-09-18 13:44 ` Pascal J. Bourguignon
  2009-09-18 13:52 ` David Kastrup
  0 siblings, 2 replies; 15+ messages in thread
From: Nordlöw @ 2009-09-18 13:15 UTC (permalink / raw)
  To: help-gnu-emacs

What is the most efficient way of performing lots of successive
appends of elements to the same list?

If we start with defining the list

(setq l '(a b))

then the Emacs manual says that we can use

(nconc l '(c d)))

I have noticed that this works in all cases except when l is nil.
To make this case work aswell we need to do use

(setq l (nconc l '(c d))))


Or can we use setcar or setcdr in a more clever way?

Reflections?
Per Nordlöw


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

end of thread, other threads:[~2009-09-28 20:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 13:15 Adding many elements to a list Nordlöw
2009-09-18 13:44 ` Pascal J. Bourguignon
2009-09-18 14:23   ` David Kastrup
2009-09-18 14:48     ` Pascal J. Bourguignon
2009-09-18 14:54       ` David Kastrup
2009-09-18 15:13         ` Pascal J. Bourguignon
2009-09-19  7:34           ` Andreas Politz
2009-09-22  7:07           ` David Kastrup
2009-09-22 11:53             ` Pascal J. Bourguignon
2009-09-22 12:16               ` David Kastrup
2009-09-22 12:37                 ` Pascal J. Bourguignon
2009-09-22 15:18                   ` David Kastrup
2009-09-28 20:03                 ` Samuel Wales
2009-09-18 16:24         ` Thierry Volpiatto
2009-09-18 13:52 ` David Kastrup

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.