fold


Description:

[ CCode ( ordering = 2 ) ]
public virtual A fold<A> (FoldFunc<A,G> f, owned A seed)

Standard aggregation function.

It takes a function, seed and first element, returns the new seed and progress to next element when the operation repeats.

Note:

Default implementation uses foreach.

Note:

In Iterator implementation operation moves the iterator to last element in iteration. If iterator is Iterator.valid the current element will be considered as well.