Given an array say a = [2,6,4,1,5]
how can I apply a prefix reduce operator on it.
For example:
Prefix sum of a = [2,8,12,13,18]
or
Prefix max of a = [2,6,6,6,6]
I want a method using which I can use any suitable reduce operators like mean, max or min on the array.