Synopsis:
accumulate(f,x0,{x1,...,xn}) -- computes the list {f(x0,x1),f(f(x0,x1),x2),...}.
i1 : accumulate(identity, a, {b,c,d,e}) |
i2 : accumulate (times, 1, 1 .. 10) |
Code:
-- ../../../Macaulay2/m2/fold.m2:4 accumulate(Function,Thing,VisibleList) := VisibleList => (f,x,v) -> apply(v, y -> x = f(x,y))