Task

Compute the sum and product of an array of integers.




spn:1> reduce({ 1, 2, 3, 4, 5 }, 0, function(x, y) { return x + y; })
= 15
spn:2> reduce({ 1, 2, 3, 4, 5 }, 1, function(x, y) { return x * y; })
= 120