reduce函数

    1. nebula> RETURN reduce(totalNum = 10, n IN range(1, 3) | totalNum + n) AS r;
    2. +----+
    3. | r |
    4. +----+
    5. | 16 |
    6. +----+
    7. nebula> RETURN reduce(totalNum = -4 * 5, n IN [1, 2] | totalNum + n * 2) AS r;
    8. | r |
    9. | -14 |
    10. +-----+
    11. nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \
    12. RETURN nodes(p)[0].age AS src1, nodes(p)[1].age AS dst2, \
    13. reduce(totalAge = 100, n IN nodes(p) | totalAge + n.age) AS sum;
    14. +------+------+-----+
    15. | src1 | dst2 | sum |
    16. +------+------+-----+
    17. | 34 | 31 | 165 |
    18. | 34 | 29 | 163 |
    19. | 34 | 33 | 167 |
    20. | 34 | 37 | 171 |
    21. +------+------+-----+
    22. nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \
    23. | GO FROM $-.VertexID over follow \
    24. WHERE properties(edge).degree != reduce(totalNum = 5, n IN range(1, 3) | properties($$).age + totalNum + n) \
    25. YIELD properties($$).name AS id, properties($$).age AS age, properties(edge).degree AS degree;
    26. +---------------------+-----+--------+
    27. | id | age | degree |
    28. +---------------------+-----+--------+
    29. | "Tim Duncan" | 42 | 95 |
    30. | "LaMarcus Aldridge" | 33 | 90 |
    31. | "Manu Ginobili" | 41 | 95 |