diff options
| author | Dave Love | 2001-01-05 16:56:21 +0000 |
|---|---|---|
| committer | Dave Love | 2001-01-05 16:56:21 +0000 |
| commit | 023045d66ddef29afa17245d4de14b9d77915f5a (patch) | |
| tree | 3f8de79c7046ec9db6149ed39261c9b5e72524f5 | |
| parent | 2d4c95097a4fb7601070751e9d444eb3bcad467a (diff) | |
| download | emacs-023045d66ddef29afa17245d4de14b9d77915f5a.tar.gz emacs-023045d66ddef29afa17245d4de14b9d77915f5a.zip | |
butlast, nbutlast.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lispref/lists.texi | 14 |
2 files changed, 18 insertions, 0 deletions
| @@ -2106,6 +2106,10 @@ long promised. | |||
| 2106 | (Display-related features are described in a page of their own below.) | 2106 | (Display-related features are described in a page of their own below.) |
| 2107 | 2107 | ||
| 2108 | +++ | 2108 | +++ |
| 2109 | ** Functions `butlast' and `nbutlast' for removing trailing elements | ||
| 2110 | from a list are now available without requiring the CL package. | ||
| 2111 | |||
| 2112 | +++ | ||
| 2109 | ** The new user-option `even-window-heights' can be set to nil | 2113 | ** The new user-option `even-window-heights' can be set to nil |
| 2110 | to prevent `display-buffer' from evening out window heights. | 2114 | to prevent `display-buffer' from evening out window heights. |
| 2111 | 2115 | ||
diff --git a/lispref/lists.texi b/lispref/lists.texi index 222f723944f..6ae9e68d402 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi | |||
| @@ -422,6 +422,20 @@ This is the same as @code{(cdr (cdr @var{cons-cell}))} | |||
| 422 | or @code{(nthcdr 2 @var{cons-cell})}. | 422 | or @code{(nthcdr 2 @var{cons-cell})}. |
| 423 | @end defun | 423 | @end defun |
| 424 | 424 | ||
| 425 | @defun butlast x &optional n | ||
| 426 | This function returns the list @var{x} with the last element, | ||
| 427 | or the last @var{n} elements, removed. If @var{n} is greater | ||
| 428 | than zero it makes a copy of the list so as not to damage the | ||
| 429 | original list. In general, @code{(append (butlast @var{x} @var{n}) | ||
| 430 | (last @var{x} @var{n}))} will return a list equal to @var{x}. | ||
| 431 | @end defun | ||
| 432 | |||
| 433 | @defun nbutlast x &optional n | ||
| 434 | This is a version of @code{butlast} that works by destructively | ||
| 435 | modifying the @code{cdr} of the appropriate element, rather than | ||
| 436 | making a copy of the list. | ||
| 437 | @end defun | ||
| 438 | |||
| 425 | @node Building Lists | 439 | @node Building Lists |
| 426 | @comment node-name, next, previous, up | 440 | @comment node-name, next, previous, up |
| 427 | @section Building Cons Cells and Lists | 441 | @section Building Cons Cells and Lists |