Accumulates all elements of a range using a function.
template foldl(F...) ;
foldl takes a function, an input range and the initial value. The function takes this initial value and the first element of the range (in this order), puts them together and returns the result. The return type of the function should be the same as the type of the initial value. This is than repeated for all the remaining elements of the range, whereby the value returned by the passed function is used at the place of the initial value.
foldl accumulates from left to right.
|F||Callable accepting the accumulator and a range element.|
int range = [1, 2, 3]; const actual = foldl!((acc, x) => acc + x)(range, 0); assert(actual == 6);