[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash f9471e4 016/439: !concat done - one less 'cl depen
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash f9471e4 016/439: !concat done - one less 'cl dependency |
Date: |
Tue, 04 Aug 2015 20:25:54 +0000 |
branch: externals/dash
commit f9471e411b220051a67484464ea6d5aeb8128d94
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
!concat done - one less 'cl dependency
---
bang.el | 6 +++---
tests.el | 10 ++++++++--
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/bang.el b/bang.el
index a410bb6..ed5c430 100644
--- a/bang.el
+++ b/bang.el
@@ -59,8 +59,8 @@
(list form-or-fn)
`(let (acc it) ,form-or-fn))))
-(defun !concat (list)
- (apply 'concatenate 'list list))
+(defun !concat (&rest lists)
+ (apply 'append (append lists '(nil))))
(defalias '!select '!filter)
(defalias '!reject 'remove-if)
@@ -68,7 +68,7 @@
(defalias '!partial 'apply-partially)
(defun !mapcat (fn list)
- (!concat (!map fn list)))
+ (apply !concat (!map fn list)))
(defun !uniq (list)
"Return a new list with all duplicates removed.
diff --git a/tests.el b/tests.el
index 367ebeb..a7bc88f 100644
--- a/tests.el
+++ b/tests.el
@@ -27,8 +27,14 @@
(should (equal (!reduce (lambda (memo item) (format "%s-%s" memo item)) '(1
2 3)) "1-2-3"))
(should (equal (!reduce (format "%s-%s" acc it) '(1 2 3)) "1-2-3"))
- (should (equal (!reduce (format "%s-%s" acc it) '()) "nil-nil"))
-)
+ (should (equal (!reduce (format "%s-%s" acc it) '()) "nil-nil")))
+
+(ert-deftest concat ()
+ "`!concat' returns the concatenation of the elements in the supplied lists"
+ (should (equal (!concat) nil))
+ (should (equal (!concat '(1)) '(1)))
+ (should (equal (!concat '(1) '(2)) '(1 2)))
+ (should (equal (!concat '(1) '(2 3) '(4)) '(1 2 3 4))))
(ert-deftest difference ()
"`!difference' returns a new list of only elements in list1 that are not in
list2."
- [elpa] externals/dash 7b52951 008/439: Add watchr script to get autotest, (continued)
- [elpa] externals/dash 7b52951 008/439: Add watchr script to get autotest, Phillip Lord, 2015/08/04
- [elpa] externals/dash 93957f0 006/439: Add travis status icon to README, Phillip Lord, 2015/08/04
- [elpa] externals/dash ad44aee 009/439: Add more tests., Phillip Lord, 2015/08/04
- [elpa] externals/dash 065f76b 005/439: Use ert.el to run on Emacs 23 as well., Phillip Lord, 2015/08/04
- [elpa] externals/dash e720428 010/439: Extract basic iteration form into macro., Phillip Lord, 2015/08/04
- [elpa] externals/dash c229ba8 011/439: Rewrite to anaphoric filter function., Phillip Lord, 2015/08/04
- [elpa] externals/dash d870282 013/439: Add some tests, and fix the bugs they uncovered., Phillip Lord, 2015/08/04
- [elpa] externals/dash 3e0ef58 012/439: !filter can now take either a function or form (anaphoric), Phillip Lord, 2015/08/04
- [elpa] externals/dash b24d056 014/439: !map macro, Phillip Lord, 2015/08/04
- [elpa] externals/dash ed2e447 015/439: !reduce macro, Phillip Lord, 2015/08/04
- [elpa] externals/dash f9471e4 016/439: !concat done - one less 'cl dependency,
Phillip Lord <=
- [elpa] externals/dash 4201ecd 017/439: Out with remove-if, in with !reject, Phillip Lord, 2015/08/04
- [elpa] externals/dash f5b16e3 018/439: Make !partial have the same quote-less API as the rest of bang., Phillip Lord, 2015/08/04
- [elpa] externals/dash a02b6c1 021/439: Add note about no 'cl required., Phillip Lord, 2015/08/04
- [elpa] externals/dash 07de30e 019/439: !mapcat macro, and with that: goodbye 'cl!, Phillip Lord, 2015/08/04
- [elpa] externals/dash 52815c5 020/439: Add documentation, Phillip Lord, 2015/08/04
- [elpa] externals/dash 73204ca 022/439: Change !contains-p to !contains? to match clojure api., Phillip Lord, 2015/08/04
- [elpa] externals/dash 6c39876 003/439: Set up test framework with one basic test, Phillip Lord, 2015/08/04
- [elpa] externals/dash c0f2c8f 026/439: Test that it works with lexical binding., Phillip Lord, 2015/08/04
- [elpa] externals/dash 754dd0d 024/439: Create stand-alone anaphoric macros, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9e74cc0 027/439: Remove dead code., Phillip Lord, 2015/08/04