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

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

[elpa] externals/dash 70caa37 432/439: Merge pull request #144 from camm


From: Phillip Lord
Subject: [elpa] externals/dash 70caa37 432/439: Merge pull request #144 from cammsaul/thread_last_make_second_arg_optional
Date: Tue, 04 Aug 2015 20:31:46 +0000

branch: externals/dash
commit 70caa37eed551e167f05f1b3bdfa635b63fe1414
Merge: 7aec562 63d2db9
Author: Matus Goljer <address@hidden>
Commit: Matus Goljer <address@hidden>

    Merge pull request #144 from cammsaul/thread_last_make_second_arg_optional
    
    Make ->>'s second arg optional
---
 dash.el |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dash.el b/dash.el
index 9788de6..483b080 100644
--- a/dash.el
+++ b/dash.el
@@ -1168,16 +1168,17 @@ second item in second form, etc."
                   (list form x)))
    (:else `(-> (-> ,x ,form) ,@more))))
 
-(defmacro ->> (x form &rest more)
+(defmacro ->> (x &optional form &rest more)
   "Thread the expr through the forms. Insert X as the last item
 in the first form, making a list of it if it is not a list
 already. If there are more forms, insert the first form as the
 last item in second form, etc."
-  (if (null more)
-      (if (listp form)
-          `(,(car form) ,@(cdr form) ,x)
-        (list form x))
-    `(->> (->> ,x ,form) ,@more)))
+  (cond
+   ((null form) x)
+   ((null more) (if (listp form)
+                    `(,@form ,x)
+                  (list form x)))
+   (:else `(->> (->> ,x ,form) ,@more))))
 
 (defmacro --> (x form &rest more)
   "Thread the expr through the forms. Insert X at the position



reply via email to

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