Mercurial > emacs
changeset 35090:b876bd6bde9e
butlast, nbutlast.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 05 Jan 2001 16:56:21 +0000 |
parents | bc14e9ea5378 |
children | bc80b0ab1630 |
files | etc/NEWS lispref/lists.texi |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS Fri Jan 05 16:52:53 2001 +0000 +++ b/etc/NEWS Fri Jan 05 16:56:21 2001 +0000 @@ -2106,6 +2106,10 @@ (Display-related features are described in a page of their own below.) +++ +** Functions `butlast' and `nbutlast' for removing trailing elements +from a list are now available without requiring the CL package. + ++++ ** The new user-option `even-window-heights' can be set to nil to prevent `display-buffer' from evening out window heights.
--- a/lispref/lists.texi Fri Jan 05 16:52:53 2001 +0000 +++ b/lispref/lists.texi Fri Jan 05 16:56:21 2001 +0000 @@ -422,6 +422,20 @@ or @code{(nthcdr 2 @var{cons-cell})}. @end defun +@defun butlast x &optional n +This function returns the list @var{x} with the last element, +or the last @var{n} elements, removed. If @var{n} is greater +than zero it makes a copy of the list so as not to damage the +original list. In general, @code{(append (butlast @var{x} @var{n}) +(last @var{x} @var{n}))} will return a list equal to @var{x}. +@end defun + +@defun nbutlast x &optional n +This is a version of @code{butlast} that works by destructively +modifying the @code{cdr} of the appropriate element, rather than +making a copy of the list. +@end defun + @node Building Lists @comment node-name, next, previous, up @section Building Cons Cells and Lists