runningReduce
Returns a list containing successive accumulation values generated by applying operation from left to right to each element and current accumulator value that starts with the first element of this array.
inline fun <S, T : S> Array<out T>.runningReduce(operation: (acc: S, T) -> S): List<S>(source)
fun main() {
val numbers = arrayOf(1, 2, 3, 4)
val cumulativeSums = numbers.runningReduce { acc, value -> acc + value }
println(cumulativeSums) // Output: [1, 3, 6, 10]
}