[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0a893f0: Better docstring and parameter name for se
From: |
Nicolas Petton |
Subject: |
[Emacs-diffs] master 0a893f0: Better docstring and parameter name for seq-find |
Date: |
Mon, 21 Sep 2015 09:53:40 +0000 |
branch: master
commit 0a893f0cfa166d7f17d982c3f0503dff2be25f62
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>
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.
---
doc/lispref/sequences.texi | 9 ++++-----
lisp/emacs-lisp/seq.el | 12 ++++++------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 6292c02..b85d5d4 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -578,15 +578,14 @@ value is the value returned by @var{predicate}.
@end example
@end defun
address@hidden seq-find predicate sequence &optional sentinel
address@hidden seq-find predicate sequence &optional default
This function returns the first element for which @var{predicate}
returns address@hidden in @var{sequence}. If no element matches
address@hidden, @var{sentinel} is returned if address@hidden,
address@hidden otherwise.
address@hidden, @var{default} is returned.
Note that this function has an ambiguity if the found element is
address@hidden, and if no @var{sentinel} is specified, as it cannot be
-known if an element was found or not.
+identical to @var{default}, as it cannot be known if an element was
+found or not.
@example
@group
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 4b50a0a..e0f17c0 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."
(throw 'seq--break result))))
nil))
-(cl-defgeneric seq-find (pred seq &optional sentinel)
+(cl-defgeneric seq-find (pred seq &optional default)
"Return the first element for which (PRED element) is non-nil in SEQ.
-If no element is found, return SENTINEL or nil.
+If no element is found, return DEFAULT.
-Note that `seq-find' has an ambiguity if the found element is nil
-and if no SENTINEL is specified, as it cannot be known if an
-element was found or not."
+Note that `seq-find' has an ambiguity if the found element is
+identical to DEFAULT, as it cannot be known if an element was
+found or not."
(catch 'seq--break
(seq-doseq (elt seq)
(when (funcall pred elt)
(throw 'seq--break elt)))
- sentinel))
+ default))
(cl-defgeneric seq-count (pred seq)
"Return the number of elements for which (PRED element) is non-nil in SEQ."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0a893f0: Better docstring and parameter name for seq-find,
Nicolas Petton <=