diff options
| author | Nicolas Petton | 2015-09-06 00:26:17 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-09-06 00:44:39 +0200 |
| commit | aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1 (patch) | |
| tree | 117e8f076fe9edb808781730f09122403855313d /doc | |
| parent | c36663d866e64fcb4b0d94742009d84366e9b54f (diff) | |
| download | emacs-aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1.tar.gz emacs-aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1.zip | |
Improve the semantic of seq-some
Update seq-some to return non-nil if the predicate returns non-nil for
any element of the seq, in which case the returned value is the one
returned by the predicate.
* lisp/emacs-lisp/seq.el (seq-some): Update the function and its
docstring.
* test/automated/seq-tests.el (test-seq-some): Add a regression test.
* doc/lispref/sequences.texi (Sequence Functions): Update the
documentation for seq-some.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/sequences.texi | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 22ae9959602..f73779bd9ce 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -558,18 +558,23 @@ calling @var{function}. | |||
| 558 | @end defun | 558 | @end defun |
| 559 | 559 | ||
| 560 | @defun seq-some predicate sequence | 560 | @defun seq-some predicate sequence |
| 561 | This function returns the first member of sequence for which @var{predicate} | 561 | This function returns non-@code{nil} if @var{predicate} returns |
| 562 | returns non-@code{nil}. | 562 | non-@code{nil} for any element of @var{sequence}. If so, the returned |
| 563 | value is the value returned by @var{predicate}. | ||
| 563 | 564 | ||
| 564 | @example | 565 | @example |
| 565 | @group | 566 | @group |
| 566 | (seq-some #'numberp ["abc" 1 nil]) | 567 | (seq-some #'numberp ["abc" 1 nil]) |
| 567 | @result{} 1 | 568 | @result{} t |
| 568 | @end group | 569 | @end group |
| 569 | @group | 570 | @group |
| 570 | (seq-some #'numberp ["abc" "def"]) | 571 | (seq-some #'numberp ["abc" "def"]) |
| 571 | @result{} nil | 572 | @result{} nil |
| 572 | @end group | 573 | @end group |
| 574 | @group | ||
| 575 | (seq-some #'null ["abc" 1 nil]) | ||
| 576 | @result{} t | ||
| 577 | @end group | ||
| 573 | @end example | 578 | @end example |
| 574 | @end defun | 579 | @end defun |
| 575 | 580 | ||