reduceRightIndexedOrNull

Accumulates value starting with the last element and applying operation from right to left to each element with its index in the original array and current accumulator value.

inline fun <S, T : S> Array<out T>.reduceRightIndexedOrNull(operation: (index: Int, T, acc: S) -> S): S?(source)
val fruits = arrayOf("Apple", "Banana", "Cherry")
val result = fruits.reduceRightIndexedOrNull { index, fruit, acc ->
    "$fruit($index) -> $acc"
}
println(result)   // Prints: Apple(0) -> Banana(1) -> Cherry(2)

Source