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

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

[elpa] externals/dash f86d235 268/439: Fix -cons*


From: Phillip Lord
Subject: [elpa] externals/dash f86d235 268/439: Fix -cons*
Date: Tue, 04 Aug 2015 20:28:53 +0000

branch: externals/dash
commit f86d23527ca7b667495d0d8ac9793b096ab79fb7
Author: Matus Goljer <address@hidden>
Commit: Matus Goljer <address@hidden>

    Fix -cons*
---
 dash.el         |   12 +-----------
 dev/examples.el |    4 +++-
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/dash.el b/dash.el
index 6999e64..2c77a11 100644
--- a/dash.el
+++ b/dash.el
@@ -280,17 +280,7 @@ Thus function FN should return a list."
 The last 2 members of ARGS are used as the final cons of the
 result so if the final member of ARGS is not a list the result is
 a dotted list."
-  (let (res)
-    (--each
-        args
-      (cond
-       ((not res)
-        (setq res it))
-       ((consp res)
-        (setcdr res (cons (cdr res) it)))
-       (t
-        (setq res (cons res it)))))
-    res))
+  (-reduce-r 'cons args))
 
 (defun -snoc (list elem &rest elements)
   "Append ELEM to the end of the list.
diff --git a/dev/examples.el b/dev/examples.el
index db71ca9..792883a 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -344,7 +344,9 @@
   (defexamples -cons*
     (-cons* 1 2) => '(1 . 2)
     (-cons* 1 2 3) => '(1 2 . 3)
-    (-cons* 1) => 1)
+    (-cons* 1) => 1
+    (-cons* 1 2 3 4) => '(1 2 3 . 4)
+    (apply '-cons* (number-sequence 1 10)) => '(1 2 3 4 5 6 7 8 9 . 10))
 
   (defexamples -snoc
     (-snoc '(1 2 3) 4) => '(1 2 3 4)



reply via email to

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