Function: remq

remq is a byte-compiled function defined in subr.el.gz.

Signature

(remq ELT LIST)

Documentation

Return LIST with all occurrences of ELT removed.

The comparison is done with eq. Contrary to delq, this does not use side-effects, and the argument LIST is not modified.

Other relevant functions are documented in the list group.

View in manual

Probably introduced at or before Emacs version 21.1.

Shortdoc

;; list
(remq 'b '(a b c))
    => (a c)

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun remq (elt list)
  "Return LIST with all occurrences of ELT removed.
The comparison is done with `eq'.  Contrary to `delq', this does not use
side-effects, and the argument LIST is not modified."
  (declare (side-effect-free t))
  (while (and (eq elt (car list)) (setq list (cdr list))))
  (if (memq elt list)
      (delq elt (copy-sequence list))
    list))