runningReduceIndexed

Returns a list containing successive accumulation values generated by applying operation from left to right to each character, its index in the original char sequence and current accumulator value that starts with the first character of this char sequence.

inline fun CharSequence.runningReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List<Char>(source)
val text = "kotlin"

val result = text.runningReduceIndexed { index, acc, c ->
    // For even indices keep the previous accumulator, otherwise take the current character
    if (index % 2 == 0) acc else c
}

println(result)   // prints: [k, o, t, t, o, o]

Source