foldRightIndexed

Common
JVM
JS
Native
1.0
inline fun <T, R> Array<out T>.foldRightIndexed(
    initial: R,
    operation: (index: Int, T, acc: R) -> R
): R

(source)
inline fun <R> ByteArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Byte, acc: R) -> R
): R

(source)
inline fun <R> ShortArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Short, acc: R) -> R
): R

(source)
inline fun <R> IntArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Int, acc: R) -> R
): R

(source)
inline fun <R> LongArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Long, acc: R) -> R
): R

(source)
inline fun <R> FloatArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Float, acc: R) -> R
): R

(source)
inline fun <R> DoubleArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Double, acc: R) -> R
): R

(source)
inline fun <R> BooleanArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Boolean, acc: R) -> R
): R

(source)
inline fun <R> CharArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, Char, acc: R) -> R
): R

(source)
@ExperimentalUnsignedTypes inline fun <R> UIntArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, UInt, acc: R) -> R
): R

(source)
@ExperimentalUnsignedTypes inline fun <R> ULongArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, ULong, acc: R) -> R
): R

(source)
@ExperimentalUnsignedTypes inline fun <R> UByteArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, UByte, acc: R) -> R
): R

(source)
@ExperimentalUnsignedTypes inline fun <R> UShortArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, UShort, acc: R) -> R
): R

(source)

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

Returns the specified initial value if the array is empty.

Parameters

operation - function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.

Common
JVM
JS
Native
1.0
inline fun <T, R> List<T>.foldRightIndexed(
    initial: R,
    operation: (index: Int, T, acc: R) -> R
): R

(source)

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

Returns the specified initial value if the list is empty.

Parameters

operation - function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.