**jare**

**Sat, 06 May 2017 18:23:18 GMT**

Open full view…
# Cumulative Sums

v=[1, 2, 3] f(n)=sum(x,0..n) cumsum(x)=map(f,x) cumsum(v)=> [1, 3, 6]

Sorry, that answer wasn't correct. Here's a better solution: v=[3, 5, 5, 0, 1] count(v)=reduce(x+1, v, 0) g(y,w)= if y==0 then w[0] else sum(x,w[0, 0:y]) cumsum= map( g(w=v), 0..(count(v)-1) ) => [3, 8, 13, 13, 14]