]> git.eshelyaron.com Git - emacs.git/commitdiff
Better documentation for seq-some
authorNicolas Petton <nicolas@petton.fr>
Mon, 28 Sep 2015 19:11:05 +0000 (21:11 +0200)
committerNicolas Petton <nicolas@petton.fr>
Mon, 28 Sep 2015 19:15:58 +0000 (21:15 +0200)
* doc/lispref/sequences.texi:
* lisp/emacs-lisp/seq.el: Update the documentation of seq-some to
guarantee that the returned value is the first non-nil value that
resulted from applying the predicate.

doc/lispref/sequences.texi
lisp/emacs-lisp/seq.el

index b85d5d4c1b11fd9673159b444adf43d63de0bd98..2dc494aec5d8f3499f5c6cfcc1aeffb3eb17f33e 100644 (file)
@@ -558,9 +558,8 @@ calling @var{function}.
 @end defun
 
 @defun seq-some predicate sequence
-  This function returns non-@code{nil} if @var{predicate} returns
-non-@code{nil} for any element of @var{sequence}.  If so, the returned
-value is the value returned by @var{predicate}.
+  This function returns the first non-@code{nil} value returned by
+applying @var{predicate} to each element of @var{sequence} in turn.
 
 @example
 @group
@@ -575,6 +574,10 @@ value is the value returned by @var{predicate}.
 (seq-some #'null ["abc" 1 nil])
 @result{} t
 @end group
+@group
+(seq-some #'1+ [2 4 6])
+@result{} 3
+@end group
 @end example
 @end defun
 
index e0f17c0335d1bfef97423c0803f0bff2085fbb0b..a63447d3243bc6668d4198ebf5ea57163a07fa67 100644 (file)
@@ -261,8 +261,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called."
     t))
 
 (cl-defgeneric seq-some (pred seq)
-  "Return non-nil if (PRED element) is non-nil for any element in SEQ, nil otherwise.
-If so, return the non-nil value returned by PRED."
+  "Return the first value for which if (PRED element) is non-nil for in SEQ."
   (catch 'seq--break
     (seq-doseq (elt seq)
       (let ((result (funcall pred elt)))