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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash 0f4cae9 249/439: Improve docs


From: Phillip Lord
Subject: [elpa] externals/dash 0f4cae9 249/439: Improve docs
Date: Tue, 04 Aug 2015 20:28:37 +0000

branch: externals/dash
commit 0f4cae956345b32b82d443d49ecb97f8b6375cc9
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>

    Improve docs
---
 README.md       |   24 ++++++++++++------------
 dev/examples.el |   23 ++++++++++++-----------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md
index 9439db1..e16cd06 100644
--- a/README.md
+++ b/README.md
@@ -464,7 +464,7 @@ Return the sum of `list`.
 ```cl
 (-sum '()) ;; => 0
 (-sum '(1)) ;; => 1
-(-sum '(1 2 3)) ;; => 6
+(-sum '(1 2 3 4)) ;; => 10
 ```
 
 #### -product `(list)`
@@ -474,7 +474,7 @@ Return the product of `list`.
 ```cl
 (-product '()) ;; => 1
 (-product '(1)) ;; => 1
-(-product '(1 2 3)) ;; => 6
+(-product '(1 2 3 4)) ;; => 24
 ```
 
 #### -min `(list)`
@@ -497,8 +497,8 @@ comparing them.
 
 ```cl
 (-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)
+(--min-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) ;; => '(1 2 3)
+(--min-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) ;; => '(2)
 ```
 
 #### -max `(list)`
@@ -521,8 +521,8 @@ comparing them.
 
 ```cl
 (-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
+(--max-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) ;; => '(3 2)
+(--max-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) ;; => '(1 2 3)
 ```
 
 
@@ -1064,9 +1064,9 @@ 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"
+(-> '(2 3 5)) ;; => '(2 3 5)
+(-> '(2 3 5) (append '(8 13))) ;; => '(2 3 5 8 13)
+(-> '(2 3 5) (append '(8 13)) (-slice 1 -1)) ;; => '(3 5 8)
 ```
 
 #### ->> `(x form &rest more)`
@@ -1077,9 +1077,9 @@ 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
+(->> '(1 2 3) (-map 'square)) ;; => '(1 4 9)
+(->> '(1 2 3) (-map 'square) (-remove 'even?)) ;; => '(1 9)
+(->> '(1 2 3) (-map 'square) (-reduce '+)) ;; => 14
 ```
 
 #### --> `(x form &rest more)`
diff --git a/dev/examples.el b/dev/examples.el
index 84d72f8..64b0c9a 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -130,12 +130,12 @@
   (defexamples -sum
     (-sum '()) => 0
     (-sum '(1)) => 1
-    (-sum '(1 2 3)) => 6)
+    (-sum '(1 2 3 4)) => 10)
 
   (defexamples -product
     (-product '()) => 1
     (-product '(1)) => 1
-    (-product '(1 2 3)) => 6)
+    (-product '(1 2 3 4)) => 24)
 
   (defexamples -min
     (-min '(0)) => 0
@@ -144,8 +144,8 @@
 
   (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))
+    (--min-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) => '(1 2 3)
+    (--min-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) => '(2))
 
   (defexamples -max
     (-max '(0)) => 0
@@ -154,8 +154,8 @@
 
   (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))
+    (--max-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) => '(3 2)
+    (--max-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) => '(1 2 
3)))
 
 (def-example-group "Predicates" nil
   (defexamples -any?
@@ -406,15 +406,16 @@
 
 (def-example-group "Threading macros" nil
   (defexamples ->
-    (-> "Abc") => "Abc"
-    (-> "Abc" (concat "def")) => "Abcdef"
-    (-> "Abc" (concat "def") (concat "ghi")) => "Abcdefghi"
+    (-> '(2 3 5)) => '(2 3 5)
+    (-> '(2 3 5) (append '(8 13))) => '(2 3 5 8 13)
+    (-> '(2 3 5) (append '(8 13)) (-slice 1 -1)) => '(3 5 8)
     (-> 5 square) => 25
     (-> 5 (+ 3) square) => 64)
 
   (defexamples ->>
-    (->> "Abc" (concat "def")) => "defAbc"
-    (->> "Abc" (concat "def") (concat "ghi")) => "ghidefAbc"
+    (->> '(1 2 3) (-map 'square)) => '(1 4 9)
+    (->> '(1 2 3) (-map 'square) (-remove 'even?)) => '(1 9)
+    (->> '(1 2 3) (-map 'square) (-reduce '+)) => 14
     (->> 5 (- 8)) => 3
     (->> 5 (- 3) square) => 4)
 



reply via email to

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