]> git.eshelyaron.com Git - emacs.git/commitdiff
Better docstring and parameter name for seq-find
authorNicolas Petton <nicolas@petton.fr>
Sun, 13 Sep 2015 14:18:24 +0000 (16:18 +0200)
committerNicolas Petton <nicolas@petton.fr>
Mon, 21 Sep 2015 09:48:55 +0000 (11:48 +0200)
* 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
lisp/emacs-lisp/seq.el

index 6292c02a21d4fce2297a2e9468002c2ae936d8bc..b85d5d4c1b11fd9673159b444adf43d63de0bd98 100644 (file)
@@ -578,15 +578,14 @@ value is the value returned by @var{predicate}.
 @end example
 @end defun
 
-@defun seq-find predicate sequence &optional sentinel
+@defun seq-find predicate sequence &optional default
   This function returns the first element for which @var{predicate}
 returns non-@code{nil} in @var{sequence}.  If no element matches
-@var{predicate}, @var{sentinel} is returned if non-@code{nil},
-@code{nil} otherwise.
+@var{predicate}, @var{default} is returned.
 
 Note that this function has an ambiguity if the found element is
-@code{nil}, 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
index 4b50a0a9b7b70715d96f3c5bd1e6d47fb29935f7..e0f17c0335d1bfef97423c0803f0bff2085fbb0b 100644 (file)
@@ -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."