foldLeftWithIndex<B> method
- B initialValue,
- B f(
- B accumulator,
- T element,
- int index
Fold a List into a single value by aggregating each element of the list from the first to the last using their index.
Implementation
B foldLeftWithIndex<B>(
B initialValue, B Function(B accumulator, T element, int index) f) =>
fold<Tuple2<B, int>>(
Tuple2(initialValue, 0),
(p, e) => Tuple2(f(p.first, e, p.second), p.second + 1),
).first;