diff options
| author | Nicolas Petton | 2015-09-13 16:18:24 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-09-21 11:48:55 +0200 |
| commit | 0a893f0cfa166d7f17d982c3f0503dff2be25f62 (patch) | |
| tree | cdb172d4889e26e5502fee4dbbe5f3af1d5ebc57 /lisp | |
| parent | e2f0dd2f49d8638d20615bfa38e95a71202dd543 (diff) | |
| download | emacs-0a893f0cfa166d7f17d982c3f0503dff2be25f62.tar.gz emacs-0a893f0cfa166d7f17d982c3f0503dff2be25f62.zip | |
Better docstring and parameter name for seq-find
* lisp/emacs-lisp/seq.el (seq-find): Improve the docstring and rename
the parameter `sentinel' to `default'.
* doc/lispref/sequences.texi (Sequence Functions): Update the
documentation for `seq-find' accordingly.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 4b50a0a9b7b..e0f17c0335d 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -270,18 +270,18 @@ If so, return the non-nil value returned by PRED." | |||
| 270 | (throw 'seq--break result)))) | 270 | (throw 'seq--break result)))) |
| 271 | nil)) | 271 | nil)) |
| 272 | 272 | ||
| 273 | (cl-defgeneric seq-find (pred seq &optional sentinel) | 273 | (cl-defgeneric seq-find (pred seq &optional default) |
| 274 | "Return the first element for which (PRED element) is non-nil in SEQ. | 274 | "Return the first element for which (PRED element) is non-nil in SEQ. |
| 275 | If no element is found, return SENTINEL or nil. | 275 | If no element is found, return DEFAULT. |
| 276 | 276 | ||
| 277 | Note that `seq-find' has an ambiguity if the found element is nil | 277 | Note that `seq-find' has an ambiguity if the found element is |
| 278 | and if no SENTINEL is specified, as it cannot be known if an | 278 | identical to DEFAULT, as it cannot be known if an element was |
| 279 | element was found or not." | 279 | found or not." |
| 280 | (catch 'seq--break | 280 | (catch 'seq--break |
| 281 | (seq-doseq (elt seq) | 281 | (seq-doseq (elt seq) |
| 282 | (when (funcall pred elt) | 282 | (when (funcall pred elt) |
| 283 | (throw 'seq--break elt))) | 283 | (throw 'seq--break elt))) |
| 284 | sentinel)) | 284 | default)) |
| 285 | 285 | ||
| 286 | (cl-defgeneric seq-count (pred seq) | 286 | (cl-defgeneric seq-count (pred seq) |
| 287 | "Return the number of elements for which (PRED element) is non-nil in SEQ." | 287 | "Return the number of elements for which (PRED element) is non-nil in SEQ." |