Function: seq-intersection

seq-intersection is an autoloaded and byte-compiled function defined in seq-25.el.

Signature

(seq-intersection SEQUENCE1 SEQUENCE2 &optional TESTFN)

Documentation

Return a list of all the elements that appear in both SEQUENCE1 and SEQUENCE2.

"Equality" of elements is defined by the function TESTFN, which
defaults to equal.

Other relevant functions are documented in the sequence group.

Shortdoc

;; sequence
(seq-intersection '(1 2 3) '(2 3 4))
    => (2 3)

Aliases

url-intersection (obsolete since 28.1) ediff-intersection (obsolete since 28.1)

Implementations

(sequence1 sequence2 &optional testfn) in `seq-25.el'.

Undocumented

Source Code

;; Defined in ~/.emacs.d/elpa/seq-2.24/seq-25.el
;;;###autoload
(cl-defgeneric seq-intersection (sequence1 sequence2 &optional testfn)
  "Return a list of all the elements that appear in both SEQUENCE1 and SEQUENCE2.
\"Equality\" of elements is defined by the function TESTFN, which
defaults to `equal'."
  (seq-reduce (lambda (acc elt)
                (if (seq-contains-p sequence2 elt testfn)
                    (cons elt acc)
                  acc))
              (seq-reverse sequence1)
              '()))