Function: remove
remove is a byte-compiled function defined in subr.el.gz.
Signature
(remove ELT SEQ)
Documentation
Return a copy of SEQ with all occurrences of ELT removed.
SEQ must be a list, vector, or string. The comparison is done with equal.
Contrary to delete, this does not use side-effects, and the argument
SEQ is not modified.
Other relevant functions are documented in the list group.
Probably introduced at or before Emacs version 1.1.
Shortdoc
;; list
(remove 2 '(1 2 3 4))
=> (1 3 4)
(remove "a" '("a" "b" "c" "d"))
=> ("b" "c" "d")
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun remove (elt seq)
"Return a copy of SEQ with all occurrences of ELT removed.
SEQ must be a list, vector, or string. The comparison is done with `equal'.
Contrary to `delete', this does not use side-effects, and the argument
SEQ is not modified."
(declare (side-effect-free t))
(if (nlistp seq)
;; If SEQ isn't a list, there's no need to copy SEQ because
;; `delete' will return a new object.
(delete elt seq)
(delete elt (copy-sequence seq))))