[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] fix/group-by-write-out 1c2f43d 08/14: Add "See also" for the redu
From: |
Phillip Lord |
Subject: |
[elpa] fix/group-by-write-out 1c2f43d 08/14: Add "See also" for the reduce family |
Date: |
Tue, 04 Aug 2015 19:45:07 +0000 |
branch: fix/group-by-write-out
commit 1c2f43d3793d3f2fcc3afe6d718db38bd157ec92
Author: Matus Goljer <address@hidden>
Commit: Matus Goljer <address@hidden>
Add "See also" for the reduce family
---
README.md | 8 ++++++++
dash.el | 16 ++++++++++++----
dash.texi | 8 ++++++++
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 763a8ae..8fca125 100644
--- a/README.md
+++ b/README.md
@@ -734,6 +734,8 @@ item, etc. If `list` contains no items, return
`initial-value` and
In the anaphoric form `--reduce-from`, the accumulated value is
exposed as `acc`.
+See also: [`-reduce`](#-reduce-fn-list), [`-reduce-r`](#-reduce-r-fn-list)
+
```el
(-reduce-from '- 10 '(1 2 3)) ;; => 4
(-reduce-from (lambda (memo item) (concat "(" memo " - " (int-to-string item)
")")) "10" '(1 2 3)) ;; => "(((10 - 1) - 2) - 3)"
@@ -749,6 +751,8 @@ returned and `fn` is not called.
Note: this function works the same as
[`-reduce-from`](#-reduce-from-fn-initial-value-list) but the
operation associates from right instead of from left.
+See also: [`-reduce-r`](#-reduce-r-fn-list), [`-reduce`](#-reduce-fn-list)
+
```el
(-reduce-r-from '- 10 '(1 2 3)) ;; => -8
(-reduce-r-from (lambda (item memo) (concat "(" (int-to-string item) " - "
memo ")")) "10" '(1 2 3)) ;; => "(1 - (2 - (3 - 10)))"
@@ -766,6 +770,8 @@ reduce return the result of calling `fn` with no arguments.
If
In the anaphoric form `--reduce`, the accumulated value is
exposed as `acc`.
+See also: [`-reduce-from`](#-reduce-from-fn-initial-value-list),
[`-reduce-r`](#-reduce-r-fn-list)
+
```el
(-reduce '- '(1 2 3 4)) ;; => -8
(-reduce (lambda (memo item) (format "%s-%s" memo item)) '(1 2 3)) ;; =>
"1-2-3"
@@ -786,6 +792,8 @@ accumulated value.
Note: this function works the same as [`-reduce`](#-reduce-fn-list) but the
operation
associates from right instead of from left.
+See also: [`-reduce-r-from`](#-reduce-r-from-fn-initial-value-list),
[`-reduce`](#-reduce-fn-list)
+
```el
(-reduce-r '- '(1 2 3 4)) ;; => -2
(-reduce-r (lambda (item memo) (format "%s-%s" memo item)) '(1 2 3)) ;; =>
"3-2-1"
diff --git a/dash.el b/dash.el
index 8a380b2..342d4a9 100644
--- a/dash.el
+++ b/dash.el
@@ -133,7 +133,9 @@ item, etc. If LIST contains no items, return INITIAL-VALUE
and
FN is not called.
In the anaphoric form `--reduce-from', the accumulated value is
-exposed as `acc`."
+exposed as `acc`.
+
+See also: `-reduce', `-reduce-r'"
(--reduce-from (funcall fn acc it) initial-value list))
(defmacro --reduce (form list)
@@ -153,7 +155,9 @@ reduce return the result of calling FN with no arguments. If
LIST has only 1 item, it is returned and FN is not called.
In the anaphoric form `--reduce', the accumulated value is
-exposed as `acc`."
+exposed as `acc`.
+
+See also: `-reduce-from', `-reduce-r'"
(if list
(-reduce-from fn (car list) (cdr list))
(funcall fn)))
@@ -164,7 +168,9 @@ the resulting expression. If LIST is empty, INITIAL-VALUE is
returned and FN is not called.
Note: this function works the same as `-reduce-from' but the
-operation associates from right instead of from left."
+operation associates from right instead of from left.
+
+See also: `-reduce-r', `-reduce'"
(if (not list) initial-value
(funcall fn (car list) (-reduce-r-from fn initial-value (cdr list)))))
@@ -184,7 +190,9 @@ The first argument of FN is the new item, the second is the
accumulated value.
Note: this function works the same as `-reduce' but the operation
-associates from right instead of from left."
+associates from right instead of from left.
+
+See also: `-reduce-r-from', `-reduce'"
(cond
((not list) (funcall fn))
((not (cdr list)) (car list))
diff --git a/dash.texi b/dash.texi
index 7dbdd2b..f566483 100644
--- a/dash.texi
+++ b/dash.texi
@@ -965,6 +965,8 @@ item, etc. If @var{list} contains no items, return
@var{initial-value} and
In the anaphoric form @code{--reduce-from}, the accumulated value is
exposed as `acc`.
+See also: @code{-reduce} (@pxref{-reduce}), @code{-reduce-r}
(@pxref{-reduce-r})
+
@example
@group
(-reduce-from '- 10 '(1 2 3))
@@ -990,6 +992,8 @@ returned and @var{fn} is not called.
Note: this function works the same as @code{-reduce-from}
(@pxref{-reduce-from}) but the
operation associates from right instead of from left.
+See also: @code{-reduce-r} (@pxref{-reduce-r}), @code{-reduce}
(@pxref{-reduce})
+
@example
@group
(-reduce-r-from '- 10 '(1 2 3))
@@ -1017,6 +1021,8 @@ reduce return the result of calling @var{fn} with no
arguments. If
In the anaphoric form @code{--reduce}, the accumulated value is
exposed as `acc`.
+See also: @code{-reduce-from} (@pxref{-reduce-from}), @code{-reduce-r}
(@pxref{-reduce-r})
+
@example
@group
(-reduce '- '(1 2 3 4))
@@ -1047,6 +1053,8 @@ accumulated value.
Note: this function works the same as @code{-reduce} (@pxref{-reduce}) but the
operation
associates from right instead of from left.
+See also: @code{-reduce-r-from} (@pxref{-reduce-r-from}), @code{-reduce}
(@pxref{-reduce})
+
@example
@group
(-reduce-r '- '(1 2 3 4))
- [elpa] fix/group-by-write-out aa13c07 03/14: fixed typo in docs (first where it should be last, (continued)
- [elpa] fix/group-by-write-out aa13c07 03/14: fixed typo in docs (first where it should be last, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 63d2db9 05/14: make ->>'s second arg optional, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 1677338 02/14: Merge pull request #138 from phillord/fix/group-by-write-out, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 89abffe 11/14: Make it explicit that not all VALS are evalled in -if-let*, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 70caa37 06/14: Merge pull request #144 from cammsaul/thread_last_make_second_arg_optional, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out eadb265 13/14: Swap examples to better show how -some-> works, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 36310ed 14/14: Added .elpaignore., Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out c3cf98d 12/14: Add `-some->`, `-some->>`, and `-some-->` macros., Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out e468937 09/14: Formatting, Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out b88cfb7 10/14: Add dash prefix to epsilon variable., Phillip Lord, 2015/08/04
- [elpa] fix/group-by-write-out 1c2f43d 08/14: Add "See also" for the reduce family,
Phillip Lord <=
- [elpa] fix/group-by-write-out 2aeeacb 07/14: Release 2.11.0, Phillip Lord, 2015/08/04