[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash f5b16e3 018/439: Make !partial have the same quote
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash f5b16e3 018/439: Make !partial have the same quote-less API as the rest of bang. |
Date: |
Tue, 04 Aug 2015 20:25:55 +0000 |
branch: externals/dash
commit f5b16e3b25eeac29d459b38df496d7f1116f3e62
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Make !partial have the same quote-less API as the rest of bang.
---
bang.el | 3 ++-
tests.el | 5 +++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/bang.el b/bang.el
index 42932ff..931b611 100644
--- a/bang.el
+++ b/bang.el
@@ -72,7 +72,8 @@
(defmacro !reject (form-or-fn list)
`(!filter (not ,(!--call-with-it form-or-fn)) ,list))
-(defalias '!partial 'apply-partially)
+(defmacro !partial (fn &rest args)
+ `(apply-partially ',fn ,@args))
(defun !mapcat (fn list)
(apply !concat (!map fn list)))
diff --git a/tests.el b/tests.el
index 5a72531..3d9e701 100644
--- a/tests.el
+++ b/tests.el
@@ -43,6 +43,11 @@
(should (equal (!concat '(1) '(2)) '(1 2)))
(should (equal (!concat '(1) '(2 3) '(4)) '(1 2 3 4))))
+(ert-deftest partial ()
+ "`!partial' returns a function like fn where the first arguments are filled
in"
+ (should (equal (funcall (!partial + 5) 3) 8))
+ (should (equal (funcall (!partial + 5 2) 3) 10)))
+
(ert-deftest difference ()
"`!difference' returns a new list of only elements in list1 that are not in
list2."
(should (equal (!difference '() '()) '()))
- [elpa] externals/dash ad44aee 009/439: Add more tests., (continued)
- [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, 2015/08/04
- [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 <=
- [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
- [elpa] externals/dash 8eab3d1 028/439: Slight improvements to map., Phillip Lord, 2015/08/04
- [elpa] externals/dash d2dfb11 023/439: Use double-bang for anaphoric functions, Phillip Lord, 2015/08/04