diff options
| author | Stefan Monnier | 2000-11-12 15:14:15 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-11-12 15:14:15 +0000 |
| commit | 1e344ee24587d2cf5e33cd5eb741d4edde20f33a (patch) | |
| tree | 0479c26b71f23e00a2c51306bd3b4d4dd733ddcf /lispref | |
| parent | f5ed37df73ab7f50be82c9d2e2a80d68f928df19 (diff) | |
| download | emacs-1e344ee24587d2cf5e33cd5eb741d4edde20f33a.tar.gz emacs-1e344ee24587d2cf5e33cd5eb741d4edde20f33a.zip | |
(Building Lists): Add footnote to explain how to add
to the end of a list.
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | lispref/lists.texi | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index e8e3a71f91b..64e61df4665 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2000-11-12 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * lists.texi (Building Lists): Add footnote to explain how to add | ||
| 4 | to the end of a list. | ||
| 5 | |||
| 1 | 2000-10-25 Gerd Moellmann <gerd@gnu.org> | 6 | 2000-10-25 Gerd Moellmann <gerd@gnu.org> |
| 2 | 7 | ||
| 3 | * files.texi (Visiting Functions): Typos. | 8 | * files.texi (Visiting Functions): Typos. |
diff --git a/lispref/lists.texi b/lispref/lists.texi index 458d011c489..222f723944f 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi | |||
| @@ -457,8 +457,16 @@ objects, but most often @var{object2} is a list. | |||
| 457 | 457 | ||
| 458 | @cindex consing | 458 | @cindex consing |
| 459 | @code{cons} is often used to add a single element to the front of a | 459 | @code{cons} is often used to add a single element to the front of a |
| 460 | list. This is called @dfn{consing the element onto the list}. For | 460 | list. This is called @dfn{consing the element onto the list}. |
| 461 | example: | 461 | @footnote{There is no strictly equivalent way to add an element to |
| 462 | the end of a list. You can use @code{(append @var{listname} (list | ||
| 463 | @var{newelt}))}, which creates a whole new list by copying @var{listname} | ||
| 464 | and adding @var{newelt} to its end. Or you can use @code{(nconc | ||
| 465 | @var{listname} (list @var{newelt}))}, which modifies @var{listname} | ||
| 466 | by following all the @sc{cdr}s and then replacing the terminating | ||
| 467 | @code{nil}. Compare this to adding an element to the beginning of a | ||
| 468 | list with @code{cons}, which neither copies nor modifies the list.} | ||
| 469 | For example: | ||
| 462 | 470 | ||
| 463 | @example | 471 | @example |
| 464 | (setq list (cons newelt list)) | 472 | (setq list (cons newelt list)) |