fold(Function,Thing,VisibleList) -- apply binary operator repeatedly
Synopsis:
fold(f,x0,{x1,...,xn}) -- computes f(...f(f(x0,x1),x2)...)}.
i1 : fold(identity, a, {b,c,d,e})
o1 = ((((a, b), c), d), e)
o1 : Sequence |
Code:
-- ../../../Macaulay2/m2/fold.m2:14
fold(Function,Thing,VisibleList) := VisibleList => (f,x,v) -> (scan(v, y -> x = f(x,y)); x)