Mercurial > hg > xemacs-beta
diff lisp/cl/cl-seq.el @ 201:eb5470882647 r20-3b27
Import from CVS: tag r20-3b27
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:01:22 +0200 |
parents | ac2d302a0011 |
children |
line wrap: on
line diff
--- a/lisp/cl/cl-seq.el Mon Aug 13 10:00:35 2007 +0200 +++ b/lisp/cl/cl-seq.el Mon Aug 13 10:01:22 2007 +0200 @@ -326,8 +326,22 @@ (or (and (fboundp 'delete) (subrp (symbol-function 'delete))) (defalias 'delete (function (lambda (x y) (delete* x y ':test 'equal))))) -(defun remove (x y) (remove* x y ':test 'equal)) -(defun remq (x y) (if (memq x y) (delq x (copy-list y)) y)) + +(defun remove (cl-item cl-seq) + "Remove all occurrences of ITEM in SEQ, testing with `equal' +This is a non-destructive function; it makes a copy of SEQ if necessary +to avoid corrupting the original SEQ. +Also see: `remove*', `delete', `delete*'" + (remove* cl-item cl-seq ':test 'equal)) + +(defun remq (cl-elt cl-list) + "Remove all occurances of ELT in LIST, comparing with `eq'. +This is a non-destructive function; it makes a copy of LIST to avoid +corrupting the original LIST. +Also see: `delq', `delete', `delete*', `remove', `remove*'." + (if (memq cl-elt cl-list) + (delq cl-elt (copy-list cl-list)) + cl-list)) (defun remove-duplicates (cl-seq &rest cl-keys) "Return a copy of SEQ with all duplicate elements removed.