]> git.eshelyaron.com Git - emacs.git/commitdiff
(Building Lists): Add footnote to explain how to add
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 12 Nov 2000 15:14:15 +0000 (15:14 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 12 Nov 2000 15:14:15 +0000 (15:14 +0000)
to the end of a list.

lispref/ChangeLog
lispref/lists.texi

index e8e3a71f91bdf116f9472d4a0712c42bef463204..64e61df4665c7eae6f4be4200f18bc69b3bd7294 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-12  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * lists.texi (Building Lists): Add footnote to explain how to add
+       to the end of a list.
+
 2000-10-25  Gerd Moellmann  <gerd@gnu.org>
 
        * files.texi (Visiting Functions): Typos.
index 458d011c489fbc9b708454002a6a2e31bfca018f..222f723944f1d7e425fe273b80fac62575722dcf 100644 (file)
@@ -457,8 +457,16 @@ objects, but most often @var{object2} is a list.
 
 @cindex consing
 @code{cons} is often used to add a single element to the front of a
-list.  This is called @dfn{consing the element onto the list}.  For
-example:
+list.  This is called @dfn{consing the element onto the list}.
+@footnote{There is no strictly equivalent way to add an element to
+the end of a list.  You can use @code{(append @var{listname} (list
+@var{newelt}))}, which creates a whole new list by copying @var{listname}
+and adding @var{newelt} to its end.  Or you can use @code{(nconc
+@var{listname} (list @var{newelt}))}, which modifies @var{listname}
+by following all the @sc{cdr}s and then replacing the terminating
+@code{nil}.  Compare this to adding an element to the beginning of a
+list with @code{cons}, which neither copies nor modifies the list.}
+For example:
 
 @example
 (setq list (cons newelt list))