summaryrefslogtreecommitdiff
path: root/lispref/lists.texi
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2000-11-12 15:14:15 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2000-11-12 15:14:15 +0000
commit1e344ee24587d2cf5e33cd5eb741d4edde20f33a (patch)
tree0479c26b71f23e00a2c51306bd3b4d4dd733ddcf /lispref/lists.texi
parentf5ed37df73ab7f50be82c9d2e2a80d68f928df19 (diff)
(Building Lists): Add footnote to explain how to add
to the end of a list.
Diffstat (limited to 'lispref/lists.texi')
-rw-r--r--lispref/lists.texi12
1 files changed, 10 insertions, 2 deletions
diff --git a/lispref/lists.texi b/lispref/lists.texi
index 458d011c48..222f723944 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -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))