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