[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 12291f3 191/439: Add -product function.
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 12291f3 191/439: Add -product function. |
Date: |
Tue, 04 Aug 2015 20:27:50 +0000 |
branch: externals/dash
commit 12291f3ea682d9a078bd8311db353f71737b6f4f
Author: Johan Andersson <address@hidden>
Commit: Johan Andersson <address@hidden>
Add -product function.
---
README.md | 11 +++++++++++
dash.el | 5 +++++
dev/examples.el | 5 +++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
index 9c5c536..03dcf34 100644
--- a/README.md
+++ b/README.md
@@ -76,6 +76,7 @@ Or you can just dump `dash.el` in your load path somewhere.
* [!cons](#-cons-car-cdr) `(car cdr)`
* [!cdr](#-cdr-list) `(list)`
* [-sum](#-sum-list) `(list)`
+* [-product](#-product-list) `(list)`
There are also anaphoric versions of these functions where that makes sense,
prefixed with two dashes instead of one.
@@ -836,6 +837,16 @@ Return the sum of `list`.
(-sum '(1 2 3)) ;; => 6
```
+### -product `(list)`
+
+Return the product of `list`.
+
+```cl
+(-product '()) ;; => 1
+(-product '(1)) ;; => 1
+(-product '(1 2 3)) ;; => 6
+```
+
## Contribute
diff --git a/dash.el b/dash.el
index 11e9e67..7f41af6 100644
--- a/dash.el
+++ b/dash.el
@@ -876,6 +876,10 @@ Returns nil if N is less than 1."
"Return the sum of LIST."
(apply '+ list))
+(defun -product (list)
+ "Return the product of LIST."
+ (apply '* list))
+
(eval-after-load "lisp-mode"
'(progn
(let ((new-keywords '(
@@ -979,6 +983,7 @@ Returns nil if N is less than 1."
"-repeat"
"-cons*"
"-sum"
+ "-product"
))
(special-variables '(
"it"
diff --git a/dev/examples.el b/dev/examples.el
index 4ad980f..2730583 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -341,3 +341,8 @@
(-sum '()) => 0
(-sum '(1)) => 1
(-sum '(1 2 3)) => 6)
+
+(defexamples -product
+ (-product '()) => 1
+ (-product '(1)) => 1
+ (-product '(1 2 3)) => 6)
- [elpa] externals/dash 6437adc 179/439: Release 1.3.0, (continued)
- [elpa] externals/dash 6437adc 179/439: Release 1.3.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3c546ab 178/439: Add -partition-in-steps & -partition-all-in-steps, Phillip Lord, 2015/08/04
- [elpa] externals/dash e870be8 173/439: Add -when-let* and -if-let*, Phillip Lord, 2015/08/04
- [elpa] externals/dash a3faf7c 183/439: Release 1.3.2, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5614753 182/439: Fix bug with -partition-all-in-steps, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4c8c410 180/439: Add new functions to syntax highlighting, Phillip Lord, 2015/08/04
- [elpa] externals/dash 49de164 184/439: Declare debug-info for some macros, Phillip Lord, 2015/08/04
- [elpa] externals/dash 1fc6679 185/439: Add -map-indexed to syntax highlighting, Phillip Lord, 2015/08/04
- [elpa] externals/dash 50659cc 189/439: Release 1.4.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash ff3d7bd 190/439: Add -sum function., Phillip Lord, 2015/08/04
- [elpa] externals/dash 12291f3 191/439: Add -product function.,
Phillip Lord <=
- [elpa] externals/dash de67c4b 188/439: Add `-sort`, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3226100 194/439: Indent according to emacs lisp standard, Phillip Lord, 2015/08/04
- [elpa] externals/dash 962e5b8 187/439: Merge pull request #33 from Fuco1/reduce-r, Phillip Lord, 2015/08/04
- [elpa] externals/dash d556884 186/439: Add reduce-r, the right associative variant of reduce, Phillip Lord, 2015/08/04
- [elpa] externals/dash 7e41bed 192/439: Merge pull request #35 from rejeep/sum-and-product, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2b20088 195/439: Add -juxt, Phillip Lord, 2015/08/04
- [elpa] externals/dash e07cef6 196/439: Adding -first-item and -last-item. [magnars/dash.el#17], Phillip Lord, 2015/08/04
- [elpa] externals/dash a3b2fdb 198/439: Merge pull request #38 from rejeep/min-and-max, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4164908 197/439: Add -min, -max, -min-by and -max-by., Phillip Lord, 2015/08/04
- [elpa] externals/dash 22d2c2d 199/439: Release 1.6.0, Phillip Lord, 2015/08/04