Function: gnus-set-difference

gnus-set-difference is a byte-compiled function defined in gnus-range.el.gz.

Signature

(gnus-set-difference LIST1 LIST2)

Documentation

Return a list of elements of LIST1 that do not appear in LIST2.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-range.el.gz
;; We could be using `seq-difference' here, but it's much slower
;; on these data sets.  See bug#50877.
(defun gnus-set-difference (list1 list2)
  "Return a list of elements of LIST1 that do not appear in LIST2."
  (let ((hash2 (make-hash-table :test 'eq))
        (result nil))
    (dolist (elt list2) (puthash elt t hash2))
    (dolist (elt list1)
      (unless (gethash elt hash2)
        (setq result (cons elt result))))
    (nreverse result)))