reduceIndexed

abstract fun reduceIndexed(operation: (index: Int, acc: T, T) -> T): T

对序列中的所有元素应用指定的累积操作,并返回累积结果,并提供元素的索引。

此函数类似于 Kotlin 标准库中的 reduceIndexed 函数。

参考 kotlin.sequences.reduceIndexed

Return

累积结果。

Parameters

operation

一个函数,它接收元素的索引、累积值和序列的当前元素作为参数,并返回新的累积值。

Throws

如果序列为空。