[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash e083087 145/439: Merge pull request #13 from nicfe
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash e083087 145/439: Merge pull request #13 from nicferrier/master |
Date: |
Tue, 04 Aug 2015 20:27:17 +0000 |
branch: externals/dash
commit e08308715c6292b82b4d94055f03a3c389aca2e1
Merge: 9c5fbc5 50e9f46
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Merge pull request #13 from nicferrier/master
here's -cons*
---
dash.el | 18 ++++++++++++++++++
dev/examples.el | 5 +++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/dash.el b/dash.el
index 0de6d42..2210506 100644
--- a/dash.el
+++ b/dash.el
@@ -218,6 +218,24 @@ through the REP function."
Thus function FN should return a collection."
(--mapcat (funcall fn it) list))
+(defun -cons* (&rest args)
+ "Makes a new list from the elements of ARGS.
+
+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))
+
(defmacro --first (form list)
"Anaphoric form of `-first'."
(let ((n (make-symbol "needle")))
diff --git a/dev/examples.el b/dev/examples.el
index 2fbe146..d02c5a5 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -72,6 +72,11 @@
(-mapcat (lambda (item) (list 0 item)) '(1 2 3)) => '(0 1 0 2 0 3)
(--mapcat (list 0 it) '(1 2 3)) => '(0 1 0 2 0 3))
+(defexamples -cons*
+ (-cons* 1 2) => '(1 . 2)
+ (-cons* 1 2 3) => '(1 2 . 3)
+ (-cons* 1) => 1)
+
(defexamples -any?
(-any? 'even? '(1 2 3)) => t
(-any? 'even? '(1 3 5)) => nil
- [elpa] externals/dash 1284bc6 134/439: Move .el files out of root., (continued)
- [elpa] externals/dash 1284bc6 134/439: Move .el files out of root., Phillip Lord, 2015/08/04
- [elpa] externals/dash 1120417 127/439: Add -group-by, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1c4e5d7 125/439: Remove eval from --reduce, it is evil., Phillip Lord, 2015/08/04
- [elpa] externals/dash 3044e83 129/439: Merge pull request #8 from tkf/group-by, Phillip Lord, 2015/08/04
- [elpa] externals/dash 78390f6 139/439: Merge pull request #12 from vemv/master, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0731333 140/439: Add @vemv to list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash 002e4cd 132/439: Add tali713 to list of contributors., Phillip Lord, 2015/08/04
- [elpa] externals/dash 98a82ca 142/439: DRY up -repeat with --dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8fe15ed 141/439: Group -repeat with -dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash e4521af 136/439: Add -repeat, Phillip Lord, 2015/08/04
- [elpa] externals/dash e083087 145/439: Merge pull request #13 from nicferrier/master,
Phillip Lord <=
- [elpa] externals/dash 50e9f46 144/439: -cons* for making improper lists., Phillip Lord, 2015/08/04
- [elpa] externals/dash a196ac1 137/439: Fix -repeat, Phillip Lord, 2015/08/04
- [elpa] externals/dash da8dc62 138/439: Preserve newline at new-keywords, Phillip Lord, 2015/08/04
- [elpa] externals/dash fb75a7f 146/439: Add @nicferrier to list of contributors., Phillip Lord, 2015/08/04
- [elpa] externals/dash 5161361 148/439: Clarify use of anaphoric form of -zip-with, Phillip Lord, 2015/08/04
- [elpa] externals/dash a7ee06e 149/439: Remove extra --separate definition, Phillip Lord, 2015/08/04
- [elpa] externals/dash f7a828f 147/439: Add -zip and -zip-with, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9c5fbc5 143/439: nil is the default binding in let forms, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3f604cd 151/439: Add -count, Phillip Lord, 2015/08/04
- [elpa] externals/dash cc33c2f 153/439: Stop integration tests for Emacs 23, Phillip Lord, 2015/08/04