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

[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)



reply via email to

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