[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 9ff9fd0 085/426: Move functions that are not stric
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 9ff9fd0 085/426: Move functions that are not strictly list related last. |
Date: |
Tue, 04 Aug 2015 19:36:53 +0000 |
branch: externals/dash
commit 9ff9fd06dae73aad20cf21d8eb2c81d9a2bca4a2
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Move functions that are not strictly list related last.
---
README.md | 143 +++++++++++++++++++++++++++++------------------------------
dash.el | 3 +-
examples.el | 57 ++++++++++++------------
3 files changed, 100 insertions(+), 103 deletions(-)
diff --git a/README.md b/README.md
index 58da129..6e55e09 100644
--- a/README.md
+++ b/README.md
@@ -30,11 +30,6 @@ Or you can just dump `dash.el` in your load path somewhere.
* [-interpose](#interpose-sep-list) `(sep list)`
* [-replace-where](#replace-where-pred-rep-list) `(pred rep list)`
* [-first](#first-fn-list) `(fn list)`
-* [-partial](#partial-fn-rest-args) `(fn &rest args)`
-* [-rpartial](#rpartial-fn-rest-args) `(fn &rest args)`
-* [->](#x-optional-form-rest-more) `(x &optional form &rest more)`
-* [->>](#x-form-rest-more) `(x form &rest more)`
-* [-->](#x-form-rest-more) `(x form &rest more)`
* [-difference](#difference-list-list2) `(list list2)`
* [-intersection](#intersection-list-list2) `(list list2)`
* [-distinct](#distinct-list) `(list)`
@@ -42,6 +37,11 @@ Or you can just dump `dash.el` in your load path somewhere.
* [-any?](#any-fn-list) `(fn list)`
* [-all?](#all-fn-list) `(fn list)`
* [-each](#each-list-fn) `(list fn)`
+* [-partial](#partial-fn-rest-args) `(fn &rest args)`
+* [-rpartial](#rpartial-fn-rest-args) `(fn &rest args)`
+* [->](#x-optional-form-rest-more) `(x &optional form &rest more)`
+* [->>](#x-form-rest-more) `(x form &rest more)`
+* [-->](#x-form-rest-more) `(x form &rest more)`
There are also anaphoric versions of these functions where that makes sense,
prefixed with two dashs instead of one.
@@ -158,8 +158,7 @@ Takes a nested list `l` and returns its contents as a
single, flat list.
### -concat `(&rest lists)`
-Returns a new list with the concatenation of the elements in
-the supplied `lists`.
+Returns a new list with the concatenation of the elements in the supplied
`lists`.
```cl
(-concat '(1)) ;; => '(1)
@@ -269,71 +268,6 @@ To get the first item in the list no questions asked, use
`car`.
(--first (> it 2) '(1 2 3)) ;; => 3
```
-### -partial `(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 `args` first and
-then additional args.
-
-```cl
-(funcall (-partial '- 5) 3) ;; => 2
-(funcall (-partial '+ 5 2) 3) ;; => 10
-```
-
-### -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.
-
-```cl
-(funcall (-rpartial '- 5) 8) ;; => 3
-(funcall (-rpartial '- 5 2) 10) ;; => 3
-```
-
-### -> `(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
-already. If there are more forms, inserts the first form as the
-second item in second form, etc.
-
-```cl
-(-> "Abc") ;; => "Abc"
-(-> "Abc" (concat "def")) ;; => "Abcdef"
-(-> "Abc" (concat "def") (concat "ghi")) ;; => "Abcdefghi"
-```
-
-### ->> `(x form &rest more)`
-
-Threads the expr through the forms. Inserts `x` as the last item
-in the first form, making a list of it if it is not a list
-already. If there are more forms, inserts the first form as the
-last item in second form, etc.
-
-```cl
-(->> "Abc" (concat "def")) ;; => "defAbc"
-(->> "Abc" (concat "def") (concat "ghi")) ;; => "ghidefAbc"
-(->> 5 (- 8)) ;; => 3
-```
-
-### --> `(x form &rest more)`
-
-Threads the expr through the forms. Inserts `x` at the position
-signified by the token `it` in the first form. If there are more
-forms, inserts the first form at the position signified by `it`
-in in second form, etc.
-
-```cl
-(--> "def" (concat "abc" it "ghi")) ;; => "abcdefghi"
-(--> "def" (concat "abc" it "ghi") (upcase it)) ;; => "ABCDEFGHI"
-(--> "def" (concat "abc" it "ghi") upcase) ;; => "ABCDEFGHI"
-```
-
### -difference `(list list2)`
Return a new list with only the members of `list` that are not in `list2`.
@@ -415,6 +349,71 @@ Calls `fn` with every item in `list`. Returns nil, used
for side-effects only.
(let (s) (--each '(1 2 3) (setq s (cons it s))) s) ;; => '(3 2 1)
```
+### -partial `(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 `args` first and
+then additional args.
+
+```cl
+(funcall (-partial '- 5) 3) ;; => 2
+(funcall (-partial '+ 5 2) 3) ;; => 10
+```
+
+### -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.
+
+```cl
+(funcall (-rpartial '- 5) 8) ;; => 3
+(funcall (-rpartial '- 5 2) 10) ;; => 3
+```
+
+### -> `(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
+already. If there are more forms, inserts the first form as the
+second item in second form, etc.
+
+```cl
+(-> "Abc") ;; => "Abc"
+(-> "Abc" (concat "def")) ;; => "Abcdef"
+(-> "Abc" (concat "def") (concat "ghi")) ;; => "Abcdefghi"
+```
+
+### ->> `(x form &rest more)`
+
+Threads the expr through the forms. Inserts `x` as the last item
+in the first form, making a list of it if it is not a list
+already. If there are more forms, inserts the first form as the
+last item in second form, etc.
+
+```cl
+(->> "Abc" (concat "def")) ;; => "defAbc"
+(->> "Abc" (concat "def") (concat "ghi")) ;; => "ghidefAbc"
+(->> 5 (- 8)) ;; => 3
+```
+
+### --> `(x form &rest more)`
+
+Threads the expr through the forms. Inserts `x` at the position
+signified by the token `it` in the first form. If there are more
+forms, inserts the first form at the position signified by `it`
+in in second form, etc.
+
+```cl
+(--> "def" (concat "abc" it "ghi")) ;; => "abcdefghi"
+(--> "def" (concat "abc" it "ghi") (upcase it)) ;; => "ABCDEFGHI"
+(--> "def" (concat "abc" it "ghi") upcase) ;; => "ABCDEFGHI"
+```
+
## Development
diff --git a/dash.el b/dash.el
index 392019d..6e3d266 100644
--- a/dash.el
+++ b/dash.el
@@ -137,8 +137,7 @@ Alias: `-reject'"
(list l)))
(defun -concat (&rest lists)
- "Returns a new list with the concatenation of the elements in
-the supplied LISTS."
+ "Returns a new list with the concatenation of the elements in the supplied
LISTS."
(apply 'append lists))
(defmacro --mapcat (form list)
diff --git a/examples.el b/examples.el
index fb03e5c..438f82b 100644
--- a/examples.el
+++ b/examples.el
@@ -105,33 +105,6 @@
(-first 'even? '(1 3 5)) => nil
(--first (> it 2) '(1 2 3)) => 3)
-(defexamples -partial
- (funcall (-partial '- 5) 3) => 2
- (funcall (-partial '+ 5 2) 3) => 10)
-
-(unless (version< emacs-version "24")
- (defexamples -rpartial
- (funcall (-rpartial '- 5) 8) => 3
- (funcall (-rpartial '- 5 2) 10) => 3))
-
-(defexamples ->
- (-> "Abc") => "Abc"
- (-> "Abc" (concat "def")) => "Abcdef"
- (-> "Abc" (concat "def") (concat "ghi")) => "Abcdefghi"
- (-> 5 square) => 25
- (-> 5 (+ 3) square) => 64)
-
-(defexamples ->>
- (->> "Abc" (concat "def")) => "defAbc"
- (->> "Abc" (concat "def") (concat "ghi")) => "ghidefAbc"
- (->> 5 (- 8)) => 3
- (->> 5 (- 3) square) => 4)
-
-(defexamples -->
- (--> "def" (concat "abc" it "ghi")) => "abcdefghi"
- (--> "def" (concat "abc" it "ghi") (upcase it)) => "ABCDEFGHI"
- (--> "def" (concat "abc" it "ghi") upcase) => "ABCDEFGHI")
-
(defexamples -difference
(-difference '() '()) => '()
(-difference '(1 2 3) '(4 5 6)) => '(1 2 3)
@@ -167,5 +140,31 @@
(let (s) (-each '(1 2 3) (lambda (item) (setq s (cons item s))))) => nil
(let (s) (-each '(1 2 3) (lambda (item) (setq s (cons item s)))) s) => '(3 2
1)
(let (s) (--each '(1 2 3) (setq s (cons it s))) s) => '(3 2 1)
- (let (s) (--each (reverse (three-letters)) (setq s (cons it s))) s) => '("A"
"B" "C")
- )
+ (let (s) (--each (reverse (three-letters)) (setq s (cons it s))) s) => '("A"
"B" "C"))
+
+(defexamples -partial
+ (funcall (-partial '- 5) 3) => 2
+ (funcall (-partial '+ 5 2) 3) => 10)
+
+(unless (version< emacs-version "24")
+ (defexamples -rpartial
+ (funcall (-rpartial '- 5) 8) => 3
+ (funcall (-rpartial '- 5 2) 10) => 3))
+
+(defexamples ->
+ (-> "Abc") => "Abc"
+ (-> "Abc" (concat "def")) => "Abcdef"
+ (-> "Abc" (concat "def") (concat "ghi")) => "Abcdefghi"
+ (-> 5 square) => 25
+ (-> 5 (+ 3) square) => 64)
+
+(defexamples ->>
+ (->> "Abc" (concat "def")) => "defAbc"
+ (->> "Abc" (concat "def") (concat "ghi")) => "ghidefAbc"
+ (->> 5 (- 8)) => 3
+ (->> 5 (- 3) square) => 4)
+
+(defexamples -->
+ (--> "def" (concat "abc" it "ghi")) => "abcdefghi"
+ (--> "def" (concat "abc" it "ghi") (upcase it)) => "ABCDEFGHI"
+ (--> "def" (concat "abc" it "ghi") upcase) => "ABCDEFGHI")
- [elpa] externals/dash 3802890 082/426: Simplify !concat, (continued)
- [elpa] externals/dash 3802890 082/426: Simplify !concat, Phillip Lord, 2015/08/04
- [elpa] externals/dash ec835e4 081/426: Add !split-at, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0dab44c 084/426: Add -flatten, Phillip Lord, 2015/08/04
- [elpa] externals/dash 047eeea 066/426: Run tests on Emacs 24., Phillip Lord, 2015/08/04
- [elpa] externals/dash 9410f7e 073/426: Add !replace-where, Phillip Lord, 2015/08/04
- [elpa] externals/dash 123eaaa 078/426: Docs: Refer to !replace-where from !!replace-where., Phillip Lord, 2015/08/04
- [elpa] externals/dash 70488c2 063/426: Add !rpartial, Phillip Lord, 2015/08/04
- [elpa] externals/dash 82a12a2 076/426: Add !drop-while, Phillip Lord, 2015/08/04
- [elpa] externals/dash fea1aa3 086/426: Add -interleave, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38cc9e7 088/426: Simplify -interleave with -none?, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9ff9fd0 085/426: Move functions that are not strictly list related last.,
Phillip Lord <=
- [elpa] externals/dash 0c55a4b 090/426: 1.0.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4b5e24b 087/426: Docs: move -any? -all? -none? and -each up., Phillip Lord, 2015/08/04
- [elpa] externals/dash f8d74ff 091/426: Docs: update example text to match example code., Phillip Lord, 2015/08/04
- [elpa] externals/dash eacb6f2 092/426: Docs: Better generation of github urls., Phillip Lord, 2015/08/04
- [elpa] externals/dash 8c75026 080/426: Add !drop, Phillip Lord, 2015/08/04
- [elpa] externals/dash a2941cd 097/426: Typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash b9b6330 079/426: Add !take, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6931d8a 094/426: Remove Melpa from installation while waiting for it to be included., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0bd26ac 096/426: Add aliases for -p instead of ?, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38eed45 095/426: Add rainbow-dash, Phillip Lord, 2015/08/04