[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 2a10547 271/316: Fix handling nils of -some-->
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 2a10547 271/316: Fix handling nils of -some--> |
Date: |
Mon, 15 Feb 2021 15:58:15 -0500 (EST) |
branch: externals/dash
commit 2a1054794f49e060689e5ebd2c7c917f941913e7
Author: HKey <s06139@gmail.com>
Commit: HKey <s06139@gmail.com>
Fix handling nils of -some-->
* dash.el (-some-->): Fix handling nils in arguments.
* dev/examples.el (-some-->): Add a test case.
* README.md:
* dash.texi: Regenerate docs.
Copyright-paperwork-exempt: yes
---
README.md | 4 ++--
dash.el | 8 ++++----
dash.texi | 2 +-
dev/examples.el | 3 ++-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 4f137b2..f5c116c 100644
--- a/README.md
+++ b/README.md
@@ -316,7 +316,7 @@ Functions pretending lists are trees.
* [-as->](#-as--value-variable-rest-forms) `(value variable &rest forms)`
* [-some->](#-some--x-optional-form-rest-more) `(x &optional form &rest more)`
* [-some->>](#-some--x-optional-form-rest-more) `(x &optional form &rest more)`
-* [-some-->](#-some---x-optional-form-rest-more) `(x &optional form &rest
more)`
+* [-some-->](#-some---x-rest-forms) `(x &rest forms)`
* [-doto](#-doto-init-rest-forms) `(init &rest forms)`
### Binding
@@ -2321,7 +2321,7 @@ and when that result is non-nil, through the next form,
etc.
(-some->> '(2 4 6) (-last 'even?) (+ 100)) ;; => 106
```
-#### -some--> `(x &optional form &rest more)`
+#### -some--> `(x &rest forms)`
When expr is non-nil, thread it through the first form (via
[`-->`](#---x-rest-forms)),
and when that result is non-nil, through the next form, etc.
diff --git a/dash.el b/dash.el
index b5398c2..7f23a71 100644
--- a/dash.el
+++ b/dash.el
@@ -1751,16 +1751,16 @@ and when that result is non-nil, through the next form,
etc."
(->> ,result ,form))
,@more))))
-(defmacro -some--> (x &optional form &rest more)
+(defmacro -some--> (x &rest forms)
"When expr is non-nil, thread it through the first form (via `-->'),
and when that result is non-nil, through the next form, etc."
(declare (debug ->)
(indent 1))
- (if (null form) x
+ (if (null forms) x
(let ((result (make-symbol "result")))
`(-some--> (-when-let (,result ,x)
- (--> ,result ,form))
- ,@more))))
+ (--> ,result ,(car forms)))
+ ,@(cdr forms)))))
(defmacro -doto (init &rest forms)
"Evaluate INIT and pass it as argument to FORMS with `->'.
diff --git a/dash.texi b/dash.texi
index 43222f2..ab5469f 100644
--- a/dash.texi
+++ b/dash.texi
@@ -3601,7 +3601,7 @@ and when that result is non-nil, through the next form,
etc.
@end defmac
@anchor{-some-->}
-@defmac -some--> (x &optional form &rest more)
+@defmac -some--> (x &rest forms)
When expr is non-nil, thread it through the first form (via @code{-->}
(@pxref{-->})),
and when that result is non-nil, through the next form, etc.
diff --git a/dev/examples.el b/dev/examples.el
index 82f5ebb..3d3dd5f 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -1284,7 +1284,8 @@ value rather than consuming a list to produce a single
value."
(-some--> "def" (concat "abc" it "ghi")) => "abcdefghi"
(-some--> nil (concat "abc" it "ghi")) => nil
(-some--> '(1 3 5) (-filter 'even? it) (append it it) (-map 'square it))
=> nil
- (-some--> '(2 4 6) (-filter 'even? it) (append it it) (-map 'square it))
=> '(4 16 36 4 16 36))
+ (-some--> '(2 4 6) (-filter 'even? it) (append it it) (-map 'square it))
=> '(4 16 36 4 16 36)
+ (-some--> 1 nil) !!> (void-function nil))
(defexamples -doto
(-doto (list 1 2 3) pop pop) => '(3)
- [elpa] externals/dash 0e5acda 260/316: Simplify -non-nil, (continued)
- [elpa] externals/dash 0e5acda 260/316: Simplify -non-nil, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 9ad0d2b 266/316: Extend -map-indexed docs and tests, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f61769d 256/316: * dash.el (dash--keywords): Prefer rx., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2aeb4e4 264/316: Use actual advertised function signature in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a536770 267/316: Prefer relative image links in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ce4a344 258/316: Eliminate odd? from examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f3ae7bb 259/316: Alias -remove-item to remove, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 525ede2 265/316: Improve docstring Markdown formatting, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 4a32a5d 257/316: Write -remove-last in terms of --remove-last, ELPA Syncer, 2021/02/15
- [elpa] externals/dash cbd3b29 268/316: * .elpaignore: Exclude dev/ from GNU ELPA tarball., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2a10547 271/316: Fix handling nils of -some-->,
ELPA Syncer <=
- [elpa] externals/dash 0789fd0 273/316: Fix -some--> docstring and Edebug spec, ELPA Syncer, 2021/02/15
- [elpa] externals/dash e0254c5 274/316: * dash.el (-doto): Fix Edebug spec., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 46e43c0 277/316: Fix long-standing typo in Texinfo generation, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 65eeaf6 278/316: Fix long-standing typo in examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash dbbf617 281/316: Remove dead code from examples-to-info.el, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ee9bceb 284/316: Leave Texinfo docstring indentation as is, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a6b16ea 286/316: Localize 'nil -> '() replacement in Texinfo, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 56db327 287/316: Fix printing in Emacs < 27, ELPA Syncer, 2021/02/15
- [elpa] externals/dash d76505d 289/316: Use dash--replace-all in Texinfo format-docstring, ELPA Syncer, 2021/02/15
- [elpa] externals/dash c38b06f 291/316: Port some recent manual changes to README, ELPA Syncer, 2021/02/15