(seq-contains-p): Refine the non-nil returned value

* lisp/emacs-lisp/seq.el (seq-contains-p): Like `cl-some` return the
value returned by the test function rather than t.
This commit is contained in:
Stefan Monnier 2022-03-17 09:54:41 -04:00
parent 6ed3f04e5a
commit 81bcad03e9

View file

@ -418,8 +418,9 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil."
Equality is defined by TESTFN if non-nil or by `equal' if nil."
(catch 'seq--break
(seq-doseq (e sequence)
(when (funcall (or testfn #'equal) e elt)
(throw 'seq--break t)))
(let ((r (funcall (or testfn #'equal) e elt)))
(when r
(throw 'seq--break r))))
nil))
(cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn)