diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index bf5495baac3..8dc91471312 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -261,11 +261,13 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." | |||
| 261 | t)) | 261 | t)) |
| 262 | 262 | ||
| 263 | (cl-defgeneric seq-some (pred seq) | 263 | (cl-defgeneric seq-some (pred seq) |
| 264 | "Return any element for which (PRED element) is non-nil in SEQ, nil otherwise." | 264 | "Return non-nil if (PRED element) is non-nil for any element in SEQ, nil otherwise. |
| 265 | If so, return the non-nil value returned by PRED." | ||
| 265 | (catch 'seq--break | 266 | (catch 'seq--break |
| 266 | (seq-doseq (elt seq) | 267 | (seq-doseq (elt seq) |
| 267 | (when (funcall pred elt) | 268 | (let ((result (funcall pred elt))) |
| 268 | (throw 'seq--break elt))) | 269 | (when result |
| 270 | (throw 'seq--break result)))) | ||
| 269 | nil)) | 271 | nil)) |
| 270 | 272 | ||
| 271 | (cl-defgeneric seq-count (pred seq) | 273 | (cl-defgeneric seq-count (pred seq) |
| @@ -280,8 +282,8 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." | |||
| 280 | "Return the first element in SEQ that equals to ELT. | 282 | "Return the first element in SEQ that equals to ELT. |
| 281 | Equality is defined by TESTFN if non-nil or by `equal' if nil." | 283 | Equality is defined by TESTFN if non-nil or by `equal' if nil." |
| 282 | (seq-some (lambda (e) | 284 | (seq-some (lambda (e) |
| 283 | (funcall (or testfn #'equal) elt e)) | 285 | (funcall (or testfn #'equal) elt e)) |
| 284 | seq)) | 286 | seq)) |
| 285 | 287 | ||
| 286 | (cl-defgeneric seq-uniq (seq &optional testfn) | 288 | (cl-defgeneric seq-uniq (seq &optional testfn) |
| 287 | "Return a list of the elements of SEQ with duplicates removed. | 289 | "Return a list of the elements of SEQ with duplicates removed. |