Added recipe to appendix for some basic math ops

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

Branch: refs/heads/TINKERPOP-1602
Commit: 6971e644ffc0306a968c43f055a7849761108f60
Parents: 0938ebd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 10 11:06:48 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 10 11:06:48 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6971e644/docs/src/recipes/appendix.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/appendix.asciidoc 
b/docs/src/recipes/appendix.asciidoc
index 15d7340..369d049 100644
--- a/docs/src/recipes/appendix.asciidoc
+++ b/docs/src/recipes/appendix.asciidoc
@@ -125,3 +125,15 @@ g.V().not(has("location", without(places))).
   where(values("location").is(within(places)).count().is(places.size())).
   valueMap()
 ----
+
+[[appendix-f]]
+_Methods for performing some basic mathematical operations in the "modern" 
graph._
+
+[gremlin-groovy,modern]
+----
+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):
+----
\ No newline at end of file

Reply via email to