[top][index]
search for:

fold(Function,Thing,VisibleList) -- apply binary operator repeatedly

Synopsis:

  • Function: fold -- apply binary operator repeatedly
  • Input:
  • an instance of class Function.
  • an instance of class Thing.
  • an instance of class VisibleList.
  • Output:
  • an instance of class VisibleList.
  • 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)

    [top][index]
    search for: