arrow-fx-coroutines / arrow.fx.coroutines.stream / Chunk / mapAccumulate

mapAccumulate

inline fun <S, O2> mapAccumulate(init: S, f: (S, O) -> Pair<S, O2>): Pair<S, Chunk<O2>>

Maps the supplied stateful function over each element, outputting the final state and the accumulated outputs. The first invocation of f uses init as the input state value. Each successive invocation uses the output state of the previous invocation.

Do you like Arrow?

Arrow Org
<