Mercurial > emacs
changeset 30808:fa45a01185c0
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 15 Aug 2000 13:22:09 +0000 |
parents | a788b278d7e6 |
children | 3aa7c156087a |
files | lisp/ChangeLog lispref/lists.texi |
diffstat | 2 files changed, 70 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Aug 15 13:14:45 2000 +0000 +++ b/lisp/ChangeLog Tue Aug 15 13:22:09 2000 +0000 @@ -1,3 +1,9 @@ +2000-08-15 Gerd Moellmann <gerd@gnu.org> + + * emacs-lisp/cust-print.el, emacs-lisp/cl-specs.el + * emacs-lisp/edebug.el, progmodes/hideif.el: Change authors' + mail address. + 2000-08-15 Miles Bader <miles@gnu.org> * textmodes/ispell.el (ispell-graphic-p): New constant.
--- a/lispref/lists.texi Tue Aug 15 13:14:45 2000 +0000 +++ b/lispref/lists.texi Tue Aug 15 13:22:09 2000 +0000 @@ -663,6 +663,31 @@ @end example @end defun +@defun remq object list +This function returns a copy of @var{list}, with all elements removed +which are @code{eq} to @var{object}. The letter @samp{q} in @code{remq} +says that it uses @code{eq} to compare @var{object} against the elements +of @code{list}. + +@example +@group +(setq sample-list '(a b c a b c)) + @result{} (a b c a b c) +@end group +@group +(remq 'a sample-list) + @result{} (b c b c) +@end group +@group +sample-list + @result{} (a b c a b c) +@end group +@end example +@noindent +The function @code{delq} offers a way to perform this operation +destructively. See @ref{Sets And Lists}. +@end defun + @node Modifying Lists @section Modifying Existing List Structure @cindex destructive list operations @@ -1162,7 +1187,7 @@ This function destructively removes all elements @code{eq} to @var{object} from @var{list}. The letter @samp{q} in @code{delq} says that it uses @code{eq} to compare @var{object} against the elements of -the list, like @code{memq}. +the list, like @code{memq} and @code{remq}. @end defun When @code{delq} deletes elements from the front of the list, it does so @@ -1252,25 +1277,54 @@ @end example @end defun -@defun delete object list -This function destructively removes all elements @code{equal} to -@var{object} from @var{list}. It is to @code{delq} as @code{member} is -to @code{memq}: it uses @code{equal} to compare elements with -@var{object}, like @code{member}; when it finds an element that matches, -it removes the element just as @code{delq} would. For example: +@defun delete object sequence +If @code{sequence} is a list, this function destructively removes all +elements @code{equal} to @var{object} from @var{sequence}. For lists, +@code{delete} is to @code{delq} as @code{member} is to @code{memq}: it +uses @code{equal} to compare elements with @var{object}, like +@code{member}; when it finds an element that matches, it removes the +element just as @code{delq} would. + +If @code{sequence} is a vector or string, @code{delete} returns a copy +of @code{sequence} with all elements @code{equal} to @code{object} +removed. + +For example: @example @group (delete '(2) '((2) (1) (2))) @result{} ((1)) @end group +@group +(delete '(2) [(2) (1) (2)]) + @result{} [(1)] +@end group +@end example +@end defun + +@defun remove object sequence +This function is the non-destructive counterpart of @code{delete}. If +returns a copy of @code{sequence}, a list, vector, or string, with +elements @code{equal} to @code{object} removed. For example: + +@example +@group +(remove '(2) '((2) (1) (2))) + @result{} ((1)) +@end group +@group +(remove '(2) [(2) (1) (2)]) + @result{} [(1)] +@end group @end example @end defun @quotation -@b{Common Lisp note:} The functions @code{member} and @code{delete} in -GNU Emacs Lisp are derived from Maclisp, not Common Lisp. The Common -Lisp versions do not use @code{equal} to compare elements. +@b{Common Lisp note:} The functions @code{member}, @code{delete} and +@code{remove} in GNU Emacs Lisp are derived from Maclisp, not Common +Lisp. The Common Lisp versions do not use @code{equal} to compare +elements. @end quotation See also the function @code{add-to-list}, in @ref{Setting Variables},