java.lang.Object
com.github.basking2.sdsai.itrex.functions.AbstractFunction2<FunctionInterface<Object>,Object,Object>
com.github.basking2.sdsai.itrex.functions.functional.FoldLeftFunction
All Implemented Interfaces:
FunctionInterface<Object>, BiFunction<Iterator<?>,EvaluationContext,Object>

public class FoldLeftFunction extends AbstractFunction2<FunctionInterface<Object>,Object,Object>
Fold a given value over all elements.
     
     [* Assume the add function exists. *]

     [foldLeft [curry add] 0 [1,2,3,4]]

     
 
This is much like the foldLeft function common in Scala or ML languages. There is no foldRight as iterators make it expensive to materialize to a list and then foldRight. If such an algorithm is necessary, operate on the list in a reversed projection.