[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 1812a17 226/439: Complete dash and dash-functional
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 1812a17 226/439: Complete dash and dash-functional split |
Date: |
Tue, 04 Aug 2015 20:28:16 +0000 |
branch: externals/dash
commit 1812a1790bd6d15bec4a618e130359e53d1b5240
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Complete dash and dash-functional split
Also move functions that require Emacs 24 out of dash.el
---
README.md | 37 ++++++++++++++++++++++++++++---------
dash-functional.el | 10 +++-------
dash-pkg.el | 5 -----
dash.el | 28 ----------------------------
dev/examples.el | 28 ++++++++++++----------------
readme-template.md | 27 +++++++++++++++++++++++----
6 files changed, 66 insertions(+), 69 deletions(-)
diff --git a/README.md b/README.md
index 1b594ad..8001eac 100644
--- a/README.md
+++ b/README.md
@@ -7,15 +7,19 @@ A modern list api for Emacs. No 'cl required.
- The `-min` and `-max` functions are no longer variadic, but take a
list to be more in line with the other dash functions.
-- The `-min-by` and `-max-by` now take a comparator function to sort by.
+- `-min-by` and `-max-by` now take a comparator function to sort by.
-Also: The stated scope of dash is increasing. It now includes more
+The stated scope of dash is increasing. It now includes more
functional style functions, like combinators and threading macros.
These have been creeping in anyway, since they're so darn useful. Time
to make it official. :)
+- `-rpartial`, `-juxt` and `-applify` are moved to a separate package.
+ Note that `-partial` is still in dash for backwards compatibility
+ reasons.
+
These new combinators require Emacs 24 for its lexical scope. So
-you'll have to include them with `(require 'dash-functional)`.
+they are offered in a separate package: `dash-functional`.
## Installation
@@ -23,7 +27,22 @@ It's available on [marmalade](http://marmalade-repo.org/)
and [Melpa](http://mel
M-x package-install dash
-Or you can just dump `dash.el` in your load path somewhere.
+Or you can just dump `dash.el` in your load
+path somewhere.
+
+If you want the function combinators, then also:
+
+ M-x package-install dash-functional
+
+## Using in a package
+
+Add this to the big comment block at the top:
+
+ ;; Package-Requires: ((dash "1.8.0"))
+
+To get function combinators:
+
+ ;; Package-Requires: ((dash "1.8.0") (dash-functional "1.0.0") (emacs
"24"))
## Functions
@@ -130,7 +149,7 @@ Or you can just dump `dash.el` in your load path somewhere.
### Function combinators
-These combinators require Emacs 24 for its lexical scope. So you'll have to
include them with `(require 'dash-functional)`.
+These combinators require Emacs 24 for its lexical scope. So they are offered
in a separate package: `dash-functional`.
* [-partial](#-partial-fn-rest-args) `(fn &rest args)`
* [-rpartial](#-rpartial-fn-rest-args) `(fn &rest args)`
@@ -456,7 +475,7 @@ comparing them.
```cl
(-min-by '> '(4 3 6 1)) ;; => 1
-(-min-by (-on '> 'length) '((1 2 3) (1) (1 2))) ;; => '(1)
+(-min-by '< '(4 3 6 1)) ;; => 6
(--min-by (> (length it) (length other)) '((1 2 3) (1) (1 2))) ;; => '(1)
```
@@ -480,8 +499,8 @@ comparing them.
```cl
(-max-by '> '(4 3 6 1)) ;; => 6
-(-max-by (-on '> 'car) '((2 2 3) (3) (1 2))) ;; => '(3)
(--max-by (> (car it) (car other)) '((2 2 3) (3) (1 2))) ;; => '(3)
+(-max-by '< '(4 3 6 1)) ;; => 1
```
@@ -1026,8 +1045,8 @@ In types: (b -> b -> c) -> (a -> b) -> a -> a -> c
```cl
(-sort (-on '< 'length) '((1 2 3) (1) (1 2))) ;; => '((1) (1 2) (1 2 3))
-(-sort (-on 'string-lessp 'int-to-string) '(10 12 1 2 22)) ;; => '(1 10 12 2
22)
-(funcall (-on '+ '1+) 1 2) ;; => 5
+(-min-by (-on '> 'length) '((1 2 3) (4) (1 2))) ;; => '(4)
+(-min-by (-on 'string-lessp 'int-to-string) '(2 100 22)) ;; => 22
```
### -flip `(func)`
diff --git a/dash-functional.el b/dash-functional.el
index 29bed2b..d5730d4 100644
--- a/dash-functional.el
+++ b/dash-functional.el
@@ -4,7 +4,7 @@
;; Authors: Matus Goljer <address@hidden>
;; Magnar Sveen <address@hidden>
-;; Version: 1.8.0
+;; Version: 1.0.0
;; Package-Requires: ((dash "1.8.0") (emacs "24"))
;; Keywords: lisp functions combinators
@@ -42,18 +42,14 @@ then additional args."
"Takes a function FN and fewer than the normal arguments to FN,
and returns a fn that takes a variable number of additional ARGS.
When called, the returned function calls FN with the additional
-args first and then ARGS.
-
-Requires Emacs 24 or higher."
+args first and then ARGS."
(lambda (&rest args-before) (apply fn (append args-before args))))
(defun -juxt (&rest fns)
"Takes a list of functions and returns a fn that is the
juxtaposition of those fns. The returned fn takes a variable
number of args, and returns a list containing the result of
-applying each fn to the args (left-to-right).
-
-Requires Emacs 24 or higher."
+applying each fn to the args (left-to-right)."
(lambda (&rest args) (mapcar (lambda (x) (apply x args)) fns)))
(defun -applify (fn)
diff --git a/dash-pkg.el b/dash-pkg.el
deleted file mode 100644
index 540482a..0000000
--- a/dash-pkg.el
+++ /dev/null
@@ -1,5 +0,0 @@
-(define-package
- "dash"
- "2.0.0"
- "A modern list library for Emacs."
- '())
diff --git a/dash.el b/dash.el
index 26712b1..c6b01b3 100644
--- a/dash.el
+++ b/dash.el
@@ -697,34 +697,6 @@ When called, the returned function calls FN with ARGS
first and
then additional args."
(apply 'apply-partially fn args))
-(defun -rpartial (fn &rest args)
- "Takes a function FN and fewer than the normal arguments to FN,
-and returns a fn that takes a variable number of additional ARGS.
-When called, the returned function calls FN with the additional
-args first and then ARGS.
-
-Requires Emacs 24 or higher."
- `(closure (t) (&rest args)
- (apply ',fn (append args ',args))))
-
-(defun -juxt (&rest fns)
- "Takes a list of functions and returns a fn that is the
-juxtaposition of those fns. The returned fn takes a variable
-number of args, and returns a list containing the result of
-applying each fn to the args (left-to-right).
-
-Requires Emacs 24 or higher."
- (let ((r (make-symbol "result")))
- `(closure (t) (&rest args)
- (let (,r)
- (--each ',fns (!cons (apply it args) ,r))
- (nreverse ,r)))))
-
-(defun -applify (fn)
- "Changes an n-arity function FN to a 1-arity function that
-expects a list with n items as arguments"
- (apply-partially 'apply fn))
-
(defmacro -> (x &optional form &rest more)
"Threads the expr through the forms. Inserts X as the second
item in the first form, making a list of it if it is not a list
diff --git a/dev/examples.el b/dev/examples.el
index f14cff8..5430057 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -142,26 +142,20 @@
(-min '(3 2 1)) => 1
(-min '(1 2 3)) => 1)
- (unless (version< emacs-version "24") ;; required for -on
- (defexamples -min-by
- (-min-by '> '(4 3 6 1)) => 1
- (-min-by (-on '> 'length) '((1 2 3) (1) (1 2))) => '(1)
- (--min-by (> (length it) (length other)) '((1 2 3) (1) (1 2))) => '(1)
- (-min-by (-on 'string-lessp 'int-to-string) '(2 100 22)) => 22
- (-min-by '< '(4 3 6 1)) => 6))
+ (defexamples -min-by
+ (-min-by '> '(4 3 6 1)) => 1
+ (-min-by '< '(4 3 6 1)) => 6
+ (--min-by (> (length it) (length other)) '((1 2 3) (1) (1 2))) => '(1))
(defexamples -max
(-max '(0)) => 0
(-max '(3 2 1)) => 3
(-max '(1 2 3)) => 3)
- (unless (version< emacs-version "24") ;; required for -on
- (defexamples -max-by
- (-max-by '> '(4 3 6 1)) => 6
- (-max-by (-on '> 'car) '((2 2 3) (3) (1 2))) => '(3)
- (--max-by (> (car it) (car other)) '((2 2 3) (3) (1 2))) => '(3)
- (-max-by (-on '> 'string-to-int) '("1" "2" "3")) => "3"
- (-max-by '< '(4 3 6 1)) => 1)))
+ (defexamples -max-by
+ (-max-by '> '(4 3 6 1)) => 6
+ (--max-by (> (car it) (car other)) '((2 2 3) (3) (1 2))) => '(3)
+ (-max-by '< '(4 3 6 1)) => 1))
(def-example-group "Predicates" nil
(defexamples -any?
@@ -382,7 +376,7 @@
(let ((l '(3))) (!cdr l) l) => '()
(let ((l '(3 5))) (!cdr l) l) => '(5)))
-(def-example-group "Function combinators" "These combinators require Emacs 24
for its lexical scope. So you'll have to include them with `(require
'dash-functional)`."
+(def-example-group "Function combinators" "These combinators require Emacs 24
for its lexical scope. So they are offered in a separate package:
`dash-functional`."
(defexamples -partial
(funcall (-partial '- 5) 3) => 2
(funcall (-partial '+ 5 2) 3) => 10)
@@ -404,6 +398,9 @@
(unless (version< emacs-version "24")
(defexamples -on
(-sort (-on '< 'length) '((1 2 3) (1) (1 2))) => '((1) (1 2) (1 2 3))
+ (-min-by (-on '> 'length) '((1 2 3) (4) (1 2))) => '(4)
+ (-min-by (-on 'string-lessp 'int-to-string) '(2 100 22)) => 22
+ (-max-by (-on '> 'car) '((2 2 3) (3) (1 2))) => '(3)
(-sort (-on 'string-lessp 'int-to-string) '(10 12 1 2 22)) => '(1 10 12
2 22)
(funcall (-on '+ '1+) 1 2) => 5
(funcall (-on '+ 'identity) 1 2) => 3
@@ -443,4 +440,3 @@
(funcall (-andfn (-cut < <> 10) 'even?) 12) => nil
(-filter (-andfn (-not 'even?) (-cut >= 5 <>)) '(1 2 3 4 5 6 7 8 9 10))
=> '(1 3 5))
))
-
diff --git a/readme-template.md b/readme-template.md
index 070ab62..6ee8a5b 100644
--- a/readme-template.md
+++ b/readme-template.md
@@ -7,15 +7,19 @@ A modern list api for Emacs. No 'cl required.
- The `-min` and `-max` functions are no longer variadic, but take a
list to be more in line with the other dash functions.
-- The `-min-by` and `-max-by` now take a comparator function to sort by.
+- `-min-by` and `-max-by` now take a comparator function to sort by.
-Also: The stated scope of dash is increasing. It now includes more
+The stated scope of dash is increasing. It now includes more
functional style functions, like combinators and threading macros.
These have been creeping in anyway, since they're so darn useful. Time
to make it official. :)
+- `-rpartial`, `-juxt` and `-applify` are moved to a separate package.
+ Note that `-partial` is still in dash for backwards compatibility
+ reasons.
+
These new combinators require Emacs 24 for its lexical scope. So
-you'll have to include them with `(require 'dash-functional)`.
+they are offered in a separate package: `dash-functional`.
## Installation
@@ -23,7 +27,22 @@ It's available on [marmalade](http://marmalade-repo.org/)
and [Melpa](http://mel
M-x package-install dash
-Or you can just dump `dash.el` in your load path somewhere.
+Or you can just dump `dash.el` in your load
+path somewhere.
+
+If you want the function combinators, then also:
+
+ M-x package-install dash-functional
+
+## Using in a package
+
+Add this to the big comment block at the top:
+
+ ;; Package-Requires: ((dash "1.8.0"))
+
+To get function combinators:
+
+ ;; Package-Requires: ((dash "1.8.0") (dash-functional "1.0.0") (emacs
"24"))
## Functions
- [elpa] externals/dash 9abae5e 211/439: Add combinators, (continued)
- [elpa] externals/dash 9abae5e 211/439: Add combinators, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9a149bf 219/439: Add anaphoric example to --max-by and --min-by, Phillip Lord, 2015/08/04
- [elpa] externals/dash d374fcc 214/439: Revert "Add combinators", Phillip Lord, 2015/08/04
- [elpa] externals/dash 2a7fbdc 218/439: Update -max-by & friends, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6911514 221/439: Update docs too, Phillip Lord, 2015/08/04
- [elpa] externals/dash 86de963 217/439: Add docs about require for dash-functional, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4a144c6 220/439: Release 2.0.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9b0166a 224/439: Fix terminology, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6d0a8d6 225/439: Add Version and Package-Requires to files #45, Phillip Lord, 2015/08/04
- [elpa] externals/dash d365f22 222/439: Fix byte compile warnings, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1812a17 226/439: Complete dash and dash-functional split,
Phillip Lord <=
- [elpa] externals/dash f1049f1 216/439: Add dash-functional back, now dependent on dash.el, Phillip Lord, 2015/08/04
- [elpa] externals/dash 39d20f2 228/439: Release 2.0.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 81e43ad 229/439: Add -union to list of highlighted symbols., Phillip Lord, 2015/08/04
- [elpa] externals/dash 515e2d3 230/439: Use `comparator` instead of `predicate` for sort., Phillip Lord, 2015/08/04
- [elpa] externals/dash 6cc7727 234/439: Release 2.1.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6eeb692 236/439: Provide an implementation of function composition., Phillip Lord, 2015/08/04
- [elpa] externals/dash 23ab726 227/439: Improve formatting of docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 87c8b91 232/439: Add indexing operations, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1e2bd96 233/439: Merge pull request #48 from Fuco1/index-operations, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5232399 238/439: Merge pull request #50 from kurisuwhyte/master, Phillip Lord, 2015/08/04