foldRightWithIndex<B> method

B foldRightWithIndex<B>(
  1. B b,
  2. B f(
    1. int i,
    2. B acc,
    3. A a
    )
)

Implementation

B foldRightWithIndex<B>(B b, B Function(int i, B acc, A a) f) =>
    foldRight<Tuple2<B, int>>(
      Tuple2(b, length() - 1),
      (t, a) => Tuple2(f(t.second, t.first, a), t.second - 1),
    ).first;