branch: externals/dash commit f69a9df16fe4edbda829f1f6a2b1f5a7856e4744 Author: Basil L. Contovounesios <conto...@tcd.ie> Commit: Basil L. Contovounesios <conto...@tcd.ie>
Replace -first with -some in -any? Extend examples accordingly. Fixes #239 --- dash.el | 2 +- dev/examples.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dash.el b/dash.el index 9d30c6a..4942772 100644 --- a/dash.el +++ b/dash.el @@ -629,7 +629,7 @@ Alias: `-any'" (defmacro --any? (form list) "Anaphoric form of `-any?'." (declare (debug (form form))) - `(---truthy? (--first ,form ,list))) + `(---truthy? (--some ,form ,list))) (defun -any? (pred list) "Return t if (PRED x) is non-nil for any x in LIST, else nil. diff --git a/dev/examples.el b/dev/examples.el index d19164a..8b94fdb 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -384,6 +384,8 @@ new list." (defexamples -any? (-any? 'even? '(1 2 3)) => t (-any? 'even? '(1 3 5)) => nil + (-any? 'null '(1 3 5)) => nil + (-any? 'null '(1 3 ())) => t (--any? (= 0 (% it 2)) '(1 2 3)) => t) (defexamples -all? @@ -698,10 +700,14 @@ new list." (defexamples -first (-first 'even? '(1 2 3)) => 2 (-first 'even? '(1 3 5)) => nil + (-first 'null '(1 3 5)) => nil + (-first 'null '(1 3 ())) => nil (--first (> it 2) '(1 2 3)) => 3) (defexamples -some (-some 'even? '(1 2 3)) => t + (-some 'null '(1 2 3)) => nil + (-some 'null '(1 2 ())) => t (--some (member 'foo it) '((foo bar) (baz))) => '(foo bar) (--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3))) => 2)