emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash d732ab3 3/5: List -some and -every under Predicate


From: ELPA Syncer
Subject: [elpa] externals/dash d732ab3 3/5: List -some and -every under Predicates
Date: Tue, 6 Jul 2021 15:57:09 -0400 (EDT)

branch: externals/dash
commit d732ab3e907f91b50b67d341c574fd56e5e1a3d7
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    List -some and -every under Predicates
    
    * dev/examples.el (-some, -every): Move from "Other list operations"
    to "Predicates".
    
    * README.md:
    * dash.texi: Regenerate docs.
---
 README.md       |  68 ++++++++++++++++++------------------
 dash.texi       | 104 ++++++++++++++++++++++++++++----------------------------
 dev/examples.el |  92 ++++++++++++++++++++++++-------------------------
 3 files changed, 132 insertions(+), 132 deletions(-)

diff --git a/README.md b/README.md
index 3dd2e20..5c47209 100644
--- a/README.md
+++ b/README.md
@@ -215,6 +215,8 @@ value rather than consuming a list to produce a single 
value.
 
 Reductions of one or more lists to a boolean value.
 
+* [`-some`](#-some-pred-list) `(pred list)`
+* [`-every`](#-every-pred-list) `(pred list)`
 * [`-any?`](#-any-pred-list) `(pred list)`
 * [`-all?`](#-all-pred-list) `(pred list)`
 * [`-none?`](#-none-pred-list) `(pred list)`
@@ -292,8 +294,6 @@ Other list functions not fit to be classified elsewhere.
 * [`-table`](#-table-fn-rest-lists) `(fn &rest lists)`
 * [`-table-flat`](#-table-flat-fn-rest-lists) `(fn &rest lists)`
 * [`-first`](#-first-pred-list) `(pred list)`
-* [`-some`](#-some-pred-list) `(pred list)`
-* [`-every`](#-every-pred-list) `(pred list)`
 * [`-last`](#-last-pred-list) `(pred list)`
 * [`-first-item`](#-first-item-list) `(list)`
 * [`-second-item`](#-second-item-list) `(list)`
@@ -1269,6 +1269,38 @@ the new seed.
 
 Reductions of one or more lists to a boolean value.
 
+#### -some `(pred list)`
+
+Return (`pred` x) for the first `list` item where (`pred` x) is non-nil, else 
nil.
+
+Alias: `-any`.
+
+This function's anaphoric counterpart is `--some`.
+
+```el
+(-some #'stringp '(1 "2" 3)) ;; => t
+(--some (string-match-p "x" it) '("foo" "axe" "xor")) ;; => 1
+(--some (= it-index 3) '(0 1 2)) ;; => nil
+```
+
+#### -every `(pred list)`
+
+Return non-nil if `pred` returns non-nil for all items in `list`.
+If so, return the last such result of `pred`.  Otherwise, once an
+item is reached for which `pred` returns nil, return nil without
+calling `pred` on any further `list` elements.
+
+This function is like `-every-p`, but on success returns the last
+non-nil result of `pred` instead of just t.
+
+This function's anaphoric counterpart is `--every`.
+
+```el
+(-every #'numberp '(1 2 3)) ;; => t
+(--every (string-match-p "x" it) '("axe" "xor")) ;; => 0
+(--every (= it it-index) '(0 1 3)) ;; => nil
+```
+
 #### -any? `(pred list)`
 
 Return t if (`pred` x) is non-nil for any x in `list`, else nil.
@@ -2019,38 +2051,6 @@ This function's anaphoric counterpart is `--first`.
 (--first (> it 2) '(1 2 3)) ;; => 3
 ```
 
-#### -some `(pred list)`
-
-Return (`pred` x) for the first `list` item where (`pred` x) is non-nil, else 
nil.
-
-Alias: `-any`.
-
-This function's anaphoric counterpart is `--some`.
-
-```el
-(-some #'stringp '(1 "2" 3)) ;; => t
-(--some (string-match-p "x" it) '("foo" "axe" "xor")) ;; => 1
-(--some (= it-index 3) '(0 1 2)) ;; => nil
-```
-
-#### -every `(pred list)`
-
-Return non-nil if `pred` returns non-nil for all items in `list`.
-If so, return the last such result of `pred`.  Otherwise, once an
-item is reached for which `pred` returns nil, return nil without
-calling `pred` on any further `list` elements.
-
-This function is like `-every-p`, but on success returns the last
-non-nil result of `pred` instead of just t.
-
-This function's anaphoric counterpart is `--every`.
-
-```el
-(-every #'numberp '(1 2 3)) ;; => t
-(--every (string-match-p "x" it) '("axe" "xor")) ;; => 0
-(--every (= it it-index) '(0 1 3)) ;; => nil
-```
-
 #### -last `(pred list)`
 
 Return the last x in `list` where (`pred` x) is non-nil, else nil.
diff --git a/dash.texi b/dash.texi
index b17166e..1c5022b 100644
--- a/dash.texi
+++ b/dash.texi
@@ -1714,6 +1714,58 @@ the new seed.
 
 Reductions of one or more lists to a boolean value.
 
+@anchor{-some}
+@defun -some (pred list)
+Return (@var{pred} x) for the first @var{list} item where (@var{pred} x) is 
non-nil, else nil.
+
+Alias: @code{-any}.
+
+This function's anaphoric counterpart is @code{--some}.
+
+@example
+@group
+(-some #'stringp '(1 "2" 3))
+    @result{} t
+@end group
+@group
+(--some (string-match-p "x" it) '("foo" "axe" "xor"))
+    @result{} 1
+@end group
+@group
+(--some (= it-index 3) '(0 1 2))
+    @result{} nil
+@end group
+@end example
+@end defun
+
+@anchor{-every}
+@defun -every (pred list)
+Return non-nil if @var{pred} returns non-nil for all items in @var{list}.
+If so, return the last such result of @var{pred}.  Otherwise, once an
+item is reached for which @var{pred} returns nil, return nil without
+calling @var{pred} on any further @var{list} elements.
+
+This function is like @code{-every-p}, but on success returns the last
+non-nil result of @var{pred} instead of just t.
+
+This function's anaphoric counterpart is @code{--every}.
+
+@example
+@group
+(-every #'numberp '(1 2 3))
+    @result{} t
+@end group
+@group
+(--every (string-match-p "x" it) '("axe" "xor"))
+    @result{} 0
+@end group
+@group
+(--every (= it it-index) '(0 1 3))
+    @result{} nil
+@end group
+@end example
+@end defun
+
 @anchor{-any?}
 @defun -any? (pred list)
 Return t if (@var{pred} x) is non-nil for any x in @var{list}, else nil.
@@ -3013,58 +3065,6 @@ This function's anaphoric counterpart is @code{--first}.
 @end example
 @end defun
 
-@anchor{-some}
-@defun -some (pred list)
-Return (@var{pred} x) for the first @var{list} item where (@var{pred} x) is 
non-nil, else nil.
-
-Alias: @code{-any}.
-
-This function's anaphoric counterpart is @code{--some}.
-
-@example
-@group
-(-some #'stringp '(1 "2" 3))
-    @result{} t
-@end group
-@group
-(--some (string-match-p "x" it) '("foo" "axe" "xor"))
-    @result{} 1
-@end group
-@group
-(--some (= it-index 3) '(0 1 2))
-    @result{} nil
-@end group
-@end example
-@end defun
-
-@anchor{-every}
-@defun -every (pred list)
-Return non-nil if @var{pred} returns non-nil for all items in @var{list}.
-If so, return the last such result of @var{pred}.  Otherwise, once an
-item is reached for which @var{pred} returns nil, return nil without
-calling @var{pred} on any further @var{list} elements.
-
-This function is like @code{-every-p}, but on success returns the last
-non-nil result of @var{pred} instead of just t.
-
-This function's anaphoric counterpart is @code{--every}.
-
-@example
-@group
-(-every #'numberp '(1 2 3))
-    @result{} t
-@end group
-@group
-(--every (string-match-p "x" it) '("axe" "xor"))
-    @result{} 0
-@end group
-@group
-(--every (= it it-index) '(0 1 3))
-    @result{} nil
-@end group
-@end example
-@end defun
-
 @anchor{-last}
 @defun -last (pred list)
 Return the last x in @var{list} where (@var{pred} x) is non-nil, else nil.
diff --git a/dev/examples.el b/dev/examples.el
index e0da02d..2fb511f 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -624,6 +624,52 @@ value rather than consuming a list to produce a single 
value."
 (def-example-group "Predicates"
   "Reductions of one or more lists to a boolean value."
 
+  (defexamples -some
+    (-some #'stringp '(1 "2" 3)) => t
+    (--some (string-match-p "x" it) '("foo" "axe" "xor")) => 1
+    (--some (= it-index 3) '(0 1 2)) => nil
+    (-some (lambda (s) (string-match-p "x" s)) '("foo" "bar" "baz")) => nil
+    (--some (member 'foo it) '((foo bar) (baz))) => '(foo bar)
+    (--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3))) => 2
+    (-some #'null '(1 2 3)) => nil
+    (-some #'null '(1)) => nil
+    (-some #'null '()) => nil
+    (--some (not it) '(1 2 3)) => nil
+    (--some (not it) '(1)) => nil
+    (--some (not it) '()) => nil
+    (-some #'identity '(1 2 3)) => 1
+    (-some #'identity '(1)) => 1
+    (-some #'identity '()) => nil
+    (--some it '(1 2 3)) => 1
+    (--some it '(1)) => 1
+    (--some it '()) => nil)
+
+  (defexamples -every
+    (-every #'numberp '(1 2 3)) => t
+    (--every (string-match-p "x" it) '("axe" "xor")) => 0
+    (--every (= it it-index) '(0 1 3)) => nil
+    (-every #'ignore '()) => t
+    (-every #'ignore '(0)) => nil
+    (-every #'ignore '(0 1)) => nil
+    (--every nil '()) => t
+    (--every nil '(0)) => nil
+    (--every nil '(0 1)) => nil
+    (-every #'identity '()) => t
+    (-every #'identity '(0)) => 0
+    (-every #'identity '(0 1)) => 1
+    (--every it '()) => t
+    (--every it '(1)) => 1
+    (--every it '(1 2)) => 2
+    (--every it-index '()) => t
+    (--every it-index '(1)) => 0
+    (--every it-index '(1 2)) => 1
+    (let ((r 'r)) (-every (lambda (x) (setq r x)) '()) r) => 'r
+    (let ((r 'r)) (-every (lambda (x) (setq r x)) '(nil 1)) r) => nil
+    (let (r) (-every (lambda (x) (setq r x)) '(0 1)) r) => 1
+    (let (i) (--every (ignore (setq i it-index)) '()) i) => nil
+    (let (i) (--every (ignore (setq i it-index)) '(a)) i) => 0
+    (let (i) (--every (ignore (setq i it-index)) '(a b)) i) => 0)
+
   (defexamples -any?
     (-any? #'numberp '(nil 0 t)) => t
     (-any? #'numberp '(nil t t)) => nil
@@ -1102,52 +1148,6 @@ related predicates."
     (-first #'identity '(1)) => 1
     (-first #'identity '()) => nil)
 
-  (defexamples -some
-    (-some #'stringp '(1 "2" 3)) => t
-    (--some (string-match-p "x" it) '("foo" "axe" "xor")) => 1
-    (--some (= it-index 3) '(0 1 2)) => nil
-    (-some (lambda (s) (string-match-p "x" s)) '("foo" "bar" "baz")) => nil
-    (--some (member 'foo it) '((foo bar) (baz))) => '(foo bar)
-    (--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3))) => 2
-    (-some #'null '(1 2 3)) => nil
-    (-some #'null '(1)) => nil
-    (-some #'null '()) => nil
-    (--some (not it) '(1 2 3)) => nil
-    (--some (not it) '(1)) => nil
-    (--some (not it) '()) => nil
-    (-some #'identity '(1 2 3)) => 1
-    (-some #'identity '(1)) => 1
-    (-some #'identity '()) => nil
-    (--some it '(1 2 3)) => 1
-    (--some it '(1)) => 1
-    (--some it '()) => nil)
-
-  (defexamples -every
-    (-every #'numberp '(1 2 3)) => t
-    (--every (string-match-p "x" it) '("axe" "xor")) => 0
-    (--every (= it it-index) '(0 1 3)) => nil
-    (-every #'ignore '()) => t
-    (-every #'ignore '(0)) => nil
-    (-every #'ignore '(0 1)) => nil
-    (--every nil '()) => t
-    (--every nil '(0)) => nil
-    (--every nil '(0 1)) => nil
-    (-every #'identity '()) => t
-    (-every #'identity '(0)) => 0
-    (-every #'identity '(0 1)) => 1
-    (--every it '()) => t
-    (--every it '(1)) => 1
-    (--every it '(1 2)) => 2
-    (--every it-index '()) => t
-    (--every it-index '(1)) => 0
-    (--every it-index '(1 2)) => 1
-    (let ((r 'r)) (-every (lambda (x) (setq r x)) '()) r) => 'r
-    (let ((r 'r)) (-every (lambda (x) (setq r x)) '(nil 1)) r) => nil
-    (let (r) (-every (lambda (x) (setq r x)) '(0 1)) r) => 1
-    (let (i) (--every (ignore (setq i it-index)) '()) i) => nil
-    (let (i) (--every (ignore (setq i it-index)) '(a)) i) => 0
-    (let (i) (--every (ignore (setq i it-index)) '(a b)) i) => 0)
-
   (defexamples -last
     (-last 'even? '(1 2 3 4 5 6 3 3 3)) => 6
     (-last 'even? '(1 3 7 5 9)) => nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]