Function: cl-subst

cl-subst is a byte-compiled function defined in cl-lib.el.gz.

Signature

(cl-subst NEW OLD TREE [KEYWORD VALUE]...)

Documentation

Substitute NEW for OLD everywhere in TREE (non-destructively).

Return a copy of TREE with all elements eql to OLD replaced by NEW.

Keywords supported: :test :test-not :key

View in manual

Aliases

subst (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-lib.el.gz
(defun cl-subst (cl-new cl-old cl-tree &rest cl-keys)
  "Substitute NEW for OLD everywhere in TREE (non-destructively).
Return a copy of TREE with all elements `eql' to OLD replaced by NEW.
\nKeywords supported:  :test :test-not :key
\n(fn NEW OLD TREE [KEYWORD VALUE]...)"
  (if (or cl-keys (and (numberp cl-old) (not (integerp cl-old))))
      (apply 'cl-sublis (list (cons cl-old cl-new)) cl-tree cl-keys)
    (cl--do-subst cl-new cl-old cl-tree)))