[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 9936885 245/426: Merge pull request #51 from Fuco1
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 9936885 245/426: Merge pull request #51 from Fuco1/debug-decl |
Date: |
Tue, 04 Aug 2015 19:38:02 +0000 |
branch: externals/dash
commit 9936885588a2cbcbbfed06ea2d21f3a5b8f5e4f3
Merge: 13e0a35 459322d
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Merge pull request #51 from Fuco1/debug-decl
Debug declarations, better indent & if changed to &rest else
---
README.md | 8 ++++----
dash.el | 28 +++++++++++++++++-----------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 4b80695..9ea6343 100644
--- a/README.md
+++ b/README.md
@@ -142,8 +142,8 @@ To get function combinators:
* [-when-let](#-when-let-var-val-rest-body) `(var-val &rest body)`
* [-when-let*](#-when-let-vars-vals-rest-body) `(vars-vals &rest body)`
-* [-if-let](#-if-let-var-val-then-optional-else) `(var-val then &optional
else)`
-* [-if-let*](#-if-let-vars-vals-then-optional-else) `(vars-vals then &optional
else)`
+* [-if-let](#-if-let-var-val-then-rest-else) `(var-val then &rest else)`
+* [-if-let*](#-if-let-vars-vals-then-rest-else) `(vars-vals then &rest else)`
### Side-effects
@@ -1019,7 +1019,7 @@ If all `vals` evaluate to true, bind them to their
corresponding
(-when-let* ((x 5) (y nil) (z 7)) (+ x y z)) ;; => nil
```
-#### -if-let `(var-val then &optional else)`
+#### -if-let `(var-val then &rest else)`
If `val` evaluates to non-nil, bind it to `var` and do `then`,
otherwise do `else`. `var-val` should be a (`var` `val`) pair.
@@ -1029,7 +1029,7 @@ otherwise do `else`. `var-val` should be a (`var` `val`)
pair.
(--if-let (even? 4) it nil) ;; => t
```
-#### -if-let* `(vars-vals then &optional else)`
+#### -if-let* `(vars-vals then &rest else)`
If all `vals` evaluate to true, bind them to their corresponding
`vars` and do `then`, otherwise do `else`. `vars-vals` should be a list
diff --git a/dash.el b/dash.el
index 76fa4d4..aa7c545 100644
--- a/dash.el
+++ b/dash.el
@@ -797,6 +797,7 @@ in in second form, etc."
(defmacro -when-let (var-val &rest body)
"If VAL evaluates to non-nil, bind it to VAR and execute body.
VAR-VAL should be a (VAR VAL) pair."
+ (declare (debug ((symbolp form) body)))
(let ((var (car var-val))
(val (cadr var-val)))
`(let ((,var ,val))
@@ -807,6 +808,7 @@ VAR-VAL should be a (VAR VAL) pair."
"If all VALS evaluate to true, bind them to their corresponding
VARS and execute body. VARS-VALS should be a list of (VAR VAL)
pairs (corresponding to bindings of `let*')."
+ (declare (debug ((&rest (symbolp form)) body)))
(if (= (length vars-vals) 1)
`(-when-let ,(car vars-vals)
,@body)
@@ -817,42 +819,46 @@ VAR-VAL should be a (VAR VAL) pair."
(defmacro --when-let (val &rest body)
"If VAL evaluates to non-nil, bind it to `it' and execute
body."
+ (declare (debug (form body)))
`(let ((it ,val))
(when it
,@body)))
-(defmacro -if-let (var-val then &optional else)
+(defmacro -if-let (var-val then &rest else)
"If VAL evaluates to non-nil, bind it to VAR and do THEN,
otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair."
+ (declare (debug ((symbolp form) form body)))
(let ((var (car var-val))
(val (cadr var-val)))
`(let ((,var ,val))
- (if ,var ,then ,else))))
+ (if ,var ,then ,@else))))
-(defmacro -if-let* (vars-vals then &optional else)
+(defmacro -if-let* (vars-vals then &rest else)
"If all VALS evaluate to true, bind them to their corresponding
VARS and do THEN, otherwise do ELSE. VARS-VALS should be a list
of (VAR VAL) pairs (corresponding to the bindings of `let*')."
+ (declare (debug ((&rest (symbolp form)) form body)))
(let ((first-pair (car vars-vals))
(rest (cdr vars-vals)))
(if (= (length vars-vals) 1)
- `(-if-let ,first-pair ,then ,else)
+ `(-if-let ,first-pair ,then ,@else)
`(-if-let ,first-pair
- (-if-let* ,rest ,then ,else)
- ,else))))
+ (-if-let* ,rest ,then ,@else)
+ ,@else))))
-(defmacro --if-let (val then &optional else)
+(defmacro --if-let (val then &rest else)
"If VAL evaluates to non-nil, bind it to `it' and do THEN,
otherwise do ELSE."
+ (declare (debug (form form body)))
`(let ((it ,val))
- (if it ,then ,else)))
+ (if it ,then ,@else)))
(put '-when-let 'lisp-indent-function 1)
(put '-when-let* 'lisp-indent-function 1)
(put '--when-let 'lisp-indent-function 1)
-(put '-if-let 'lisp-indent-function 1)
-(put '-if-let* 'lisp-indent-function 1)
-(put '--if-let 'lisp-indent-function 1)
+(put '-if-let 'lisp-indent-function 2)
+(put '-if-let* 'lisp-indent-function 2)
+(put '--if-let 'lisp-indent-function 2)
(defun -distinct (list)
"Return a new list with all duplicates removed.
- [elpa] externals/dash 13e0a35 240/426: Release 2.2.0, (continued)
- [elpa] externals/dash 13e0a35 240/426: Release 2.2.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5232399 238/426: Merge pull request #50 from kurisuwhyte/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash 87c8b91 232/426: Add indexing operations, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6d20aa0 241/426: If has an indent function 2, not 1, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8e2422a 239/426: Add Christina Whyte (@kurisuwhyte) to list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1e2bd96 233/426: Merge pull request #48 from Fuco1/index-operations, Phillip Lord, 2015/08/04
- [elpa] externals/dash d1913c6 210/426: Merge pull request #41 from Wilfred/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash b4d84de 243/426: Add debug declarations for `-when-let`s and `-if-let`s, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6d43c4f 235/426: Fix switched around doc strings for -find-index/indices, Phillip Lord, 2015/08/04
- [elpa] externals/dash 459322d 244/426: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9936885 245/426: Merge pull request #51 from Fuco1/debug-decl,
Phillip Lord <=
- [elpa] externals/dash 0f4cae9 249/426: Improve docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 23ab726 227/426: Improve formatting of docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash f4ba8db 252/426: Add -snoc, Phillip Lord, 2015/08/04
- [elpa] externals/dash bf85b21 242/426: Change &optional branches to &rest branches in `-if-let`s, Phillip Lord, 2015/08/04
- [elpa] externals/dash bf99147 247/426: Fix `-tree-mapreduce-from` test & reformat the tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 75efb60 246/426: Add tree map/reduce, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2ee84cb 251/426: Release 2.3.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash ab727ba 257/426: Correct anchors for links starting with '!', Phillip Lord, 2015/08/04
- [elpa] externals/dash 8052eb9 253/426: Merge pull request #55 from Fuco1/snoc, Phillip Lord, 2015/08/04
- [elpa] externals/dash d8ccf85 254/426: Add replace/update/remove functions for index/indices, Phillip Lord, 2015/08/04