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