optimized math examples

Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9cdc47c3
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9cdc47c3
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9cdc47c3

Branch: refs/heads/TINKERPOP-1602
Commit: 9cdc47c3876ab3326de096a66228ccd43d8a42ca
Parents: f992cdf
Author: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Authored: Tue Jan 17 17:52:45 2017 +0100
Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Committed: Tue Jan 17 17:52:45 2017 +0100

----------------------------------------------------------------------
 docs/src/recipes/appendix.asciidoc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9cdc47c3/docs/src/recipes/appendix.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/appendix.asciidoc 
b/docs/src/recipes/appendix.asciidoc
index e9d13aa..55fa45d 100644
--- a/docs/src/recipes/appendix.asciidoc
+++ b/docs/src/recipes/appendix.asciidoc
@@ -169,9 +169,9 @@ _Methods for performing some basic mathematical operations 
in the "modern" graph
 ----
 g.V().values("age").sum() // sum all ages
 g.V().values("age").fold(1, mult) // multiply all ages
-g.V().values("age").map(union(identity(), constant(-1)).sum()) // subtract 1
-g.V().values("age").map(union(identity(), identity()).sum()) // multiply by 2 
(simple)
-g.V().values("age").map(union(identity(), constant(2)).fold(1, mult)) // 
multiply by 2 (generally useful for multiplications by n):
+g.withSack(0).V().values("age").sack(sum).sack(sum).by(constant(-1)).sack() // 
subtract 1
+g.withSack(0).V().values("age").sack(sum).sack(sum).sack() // multiply by 2 
(simple)
+g.withSack(0).V().values("age").sack(sum).sack(mult).by(constant(2)).sack() // 
multiply by 2 (generally useful for multiplications by n)
 ----
 
 [[appendix-g]]
@@ -259,4 +259,4 @@ g.V().as("a").
     group().
       by(select(keys).unfold()).
       by(select(values).unfold().unfold().fold()))
-----
\ No newline at end of file
+----

Reply via email to