Function: cl-ldiff

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

Signature

(cl-ldiff LIST SUBLIST)

Documentation

Return a copy of LIST with the tail SUBLIST removed.

View in manual

Aliases

ldiff (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-lib.el.gz
(defun cl-ldiff (list sublist)
  "Return a copy of LIST with the tail SUBLIST removed."
  (let ((res nil))
    (while (and (consp list) (not (eq list sublist)))
      (push (pop list) res))
    (nreverse res)))