[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 549bfd3 366/439: Reorder macros to make sure they
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 549bfd3 366/439: Reorder macros to make sure they are declared before being used |
Date: |
Tue, 04 Aug 2015 20:30:35 +0000 |
branch: externals/dash
commit 549bfd3a155467be049986bbc060db5b4dcbbe74
Author: Fredrik Bergroth <address@hidden>
Commit: Fredrik Bergroth <address@hidden>
Reorder macros to make sure they are declared before being used
---
dash.el | 116 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/dash.el b/dash.el
index 96c581b..a499245 100644
--- a/dash.el
+++ b/dash.el
@@ -1114,64 +1114,6 @@ sorts it in descending order."
(-sort comp)
(-map 'cdr))))
-(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.
-
-Note: binding is done according to `-let'."
- (declare (debug ((symbolp form) body))
- (indent 1))
- `(-if-let ,var-val (progn ,@body)))
-
-(defmacro -when-let* (vars-vals &rest body)
- "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.
-
-Note: binding is done according to `-let'."
- (declare (debug ((&rest (symbolp form)) body))
- (indent 1))
- `(-if-let* ,vars-vals (progn ,@body)))
-
-(defmacro --when-let (val &rest body)
- "If VAL evaluates to non-nil, bind it to `it' and execute
-body."
- (declare (debug (form body))
- (indent 1))
- `(--if-let ,val (progn ,@body)))
-
-(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.
-
-Note: binding is done according to `-let'."
- (declare (debug ((symbolp form) form body))
- (indent 2))
- `(-if-let* (,var-val) ,then ,@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.
-
-Note: binding is done according to `-let'."
- (declare (debug ((&rest (symbolp form)) form body))
- (indent 2))
- (->> vars-vals
- (-mapcat (-lambda ((pat src)) (dash--match pat src)))
- (-reduce-r-from
- (-lambda ((var val) memo)
- `(let ((,var ,val))
- (if ,var ,memo ,@else)))
- then)))
-
-(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))
- (indent 2))
- `(-if-let (it ,val) ,then ,@else))
-
(defun dash--match-ignore-place-p (symbol)
"Return non-nil if SYMBOL is a symbol and starts with _."
(and (symbolp symbol)
@@ -1549,6 +1491,64 @@ See `-let' for the description of destructuring
mechanism."
`(lambda ,(--map (cadr it) inputs)
(-let* ,inputs ,@body))))))
+(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.
+
+Note: binding is done according to `-let'."
+ (declare (debug ((&rest (symbolp form)) form body))
+ (indent 2))
+ (->> vars-vals
+ (-mapcat (-lambda ((pat src)) (dash--match pat src)))
+ (-reduce-r-from
+ (-lambda ((var val) memo)
+ `(let ((,var ,val))
+ (if ,var ,memo ,@else)))
+ then)))
+
+(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.
+
+Note: binding is done according to `-let'."
+ (declare (debug ((symbolp form) form body))
+ (indent 2))
+ `(-if-let* (,var-val) ,then ,@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))
+ (indent 2))
+ `(-if-let (it ,val) ,then ,@else))
+
+(defmacro -when-let* (vars-vals &rest body)
+ "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.
+
+Note: binding is done according to `-let'."
+ (declare (debug ((&rest (symbolp form)) body))
+ (indent 1))
+ `(-if-let* ,vars-vals (progn ,@body)))
+
+(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.
+
+Note: binding is done according to `-let'."
+ (declare (debug ((symbolp form) body))
+ (indent 1))
+ `(-if-let ,var-val (progn ,@body)))
+
+(defmacro --when-let (val &rest body)
+ "If VAL evaluates to non-nil, bind it to `it' and execute
+body."
+ (declare (debug (form body))
+ (indent 1))
+ `(--if-let ,val (progn ,@body)))
+
(defun -distinct (list)
"Return a new list with all duplicates removed.
The test for equality is done with `equal',
- [elpa] externals/dash 0310e0e 359/439: Update docs, (continued)
- [elpa] externals/dash 0310e0e 359/439: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 40849a7 357/439: [-let] Remove stale comment, Phillip Lord, 2015/08/04
- [elpa] externals/dash edb1e31 356/439: [-let] Add more tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4b63be1 362/439: Declare --mapcat macro before using it. #102, Phillip Lord, 2015/08/04
- [elpa] externals/dash 31f321a 358/439: Release 2.9.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2436bf8 361/439: Add debug declaration on -lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9e1a667 360/439: Do not map nodes on conses (be consistent with tree map), Phillip Lord, 2015/08/04
- [elpa] externals/dash 75d29a2 363/439: Declare --iterate macro before using it. #102, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bdf60b 365/439: Add some examples, Phillip Lord, 2015/08/04
- [elpa] externals/dash 03b98ca 364/439: Make -if-let and -when-let families destructure their arguments, Phillip Lord, 2015/08/04
- [elpa] externals/dash 549bfd3 366/439: Reorder macros to make sure they are declared before being used,
Phillip Lord <=
- [elpa] externals/dash 8707aaf 367/439: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 63fa64f 368/439: Add links to references in readme, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0c045f2 369/439: Highlight with el instead of cl, Phillip Lord, 2015/08/04
- [elpa] externals/dash d459b49 374/439: Fix typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash c09c0f6 372/439: Merge branch 'more-destructuring' (#103) of https://github.com/fbergroth/dash.el, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38ef86e 376/439: Update debug forms for -if-let and -when-let, Phillip Lord, 2015/08/04
- [elpa] externals/dash 446c522 375/439: Release 2.10.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5e9c1a9 373/439: Add Fredrik Bergroth to the list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash c134705 377/439: Fix compile warning, Phillip Lord, 2015/08/04
- [elpa] externals/dash c7b4cff 370/439: Update readme.md, Phillip Lord, 2015/08/04