reduce函数
nebula> RETURN reduce(totalNum = 10, n IN range(1, 3) | totalNum + n) AS r;
+----+
| r |
+----+
| 16 |
+----+
nebula> RETURN reduce(totalNum = -4 * 5, n IN [1, 2] | totalNum + n * 2) AS r;
| r |
| -14 |
+-----+
nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \
RETURN nodes(p)[0].age AS src1, nodes(p)[1].age AS dst2, \
reduce(totalAge = 100, n IN nodes(p) | totalAge + n.age) AS sum;
+------+------+-----+
| src1 | dst2 | sum |
+------+------+-----+
| 34 | 31 | 165 |
| 34 | 29 | 163 |
| 34 | 33 | 167 |
| 34 | 37 | 171 |
+------+------+-----+
nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \
| GO FROM $-.VertexID over follow \
WHERE properties(edge).degree != reduce(totalNum = 5, n IN range(1, 3) | properties($$).age + totalNum + n) \
YIELD properties($$).name AS id, properties($$).age AS age, properties(edge).degree AS degree;
+---------------------+-----+--------+
| id | age | degree |
+---------------------+-----+--------+
| "Tim Duncan" | 42 | 95 |
| "LaMarcus Aldridge" | 33 | 90 |
| "Manu Ginobili" | 41 | 95 |