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

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

[elpa] externals/dash f5b16e3 018/426: Make !partial have the same quote


From: Phillip Lord
Subject: [elpa] externals/dash f5b16e3 018/426: Make !partial have the same quote-less API as the rest of bang.
Date: Tue, 04 Aug 2015 19:36:25 +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 '() '()) '()))



reply via email to

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