arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / zipWithPrevious
fun zipWithPrevious():
Stream
<
Pair
<O?, O>>
Zips each element of this stream with the previous element wrapped into Some
.
The first element is zipped with None
.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream("The", "quick", "brown", "fox")
.zipWithPrevious()
.toList()
.let(::println) //[(null,The), (The,quick), (quick,brown), (brown,fox)]
//sampleEnd
Do you like Arrow?
✖