comparison 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
comparison
equal deleted inserted replaced
200:f0deb0c0e6be 201:eb5470882647
324 Keywords supported: :key :count :start :end :from-end" 324 Keywords supported: :key :count :start :end :from-end"
325 (apply 'delete* nil cl-list ':if-not cl-pred cl-keys)) 325 (apply 'delete* nil cl-list ':if-not cl-pred cl-keys))
326 326
327 (or (and (fboundp 'delete) (subrp (symbol-function 'delete))) 327 (or (and (fboundp 'delete) (subrp (symbol-function 'delete)))
328 (defalias 'delete (function (lambda (x y) (delete* x y ':test 'equal))))) 328 (defalias 'delete (function (lambda (x y) (delete* x y ':test 'equal)))))
329 (defun remove (x y) (remove* x y ':test 'equal)) 329
330 (defun remq (x y) (if (memq x y) (delq x (copy-list y)) y)) 330 (defun remove (cl-item cl-seq)
331 "Remove all occurrences of ITEM in SEQ, testing with `equal'
332 This is a non-destructive function; it makes a copy of SEQ if necessary
333 to avoid corrupting the original SEQ.
334 Also see: `remove*', `delete', `delete*'"
335 (remove* cl-item cl-seq ':test 'equal))
336
337 (defun remq (cl-elt cl-list)
338 "Remove all occurances of ELT in LIST, comparing with `eq'.
339 This is a non-destructive function; it makes a copy of LIST to avoid
340 corrupting the original LIST.
341 Also see: `delq', `delete', `delete*', `remove', `remove*'."
342 (if (memq cl-elt cl-list)
343 (delq cl-elt (copy-list cl-list))
344 cl-list))
331 345
332 (defun remove-duplicates (cl-seq &rest cl-keys) 346 (defun remove-duplicates (cl-seq &rest cl-keys)
333 "Return a copy of SEQ with all duplicate elements removed. 347 "Return a copy of SEQ with all duplicate elements removed.
334 Keywords supported: :test :test-not :key :start :end :from-end" 348 Keywords supported: :test :test-not :key :start :end :from-end"
335 (cl-delete-duplicates cl-seq cl-keys t)) 349 (cl-delete-duplicates cl-seq cl-keys t))