kotlin-flow-extensions / hu.akarnokd.kotlin.flow / reduce

reduce

fun <T, R> ParallelFlow<T>.reduce(seed: suspend () -> R, combine: suspend (R, T) -> R): ParallelFlow<R>

Reduces the source items into a single value on each rail and emits those.

@FlowPreview fun <T> ParallelFlow<T>.reduce(combine: suspend (T, T) -> T): Flow<T>

Reduce the values within the parallel rails and then reduce the rails to a single result value.