arrow-fx-coroutines / arrow.fx.coroutines.stream / interleave
fun <O>
Stream
<O>.interleave(that:
Stream
<O>):
Stream
<O>
Deterministically interleaves elements, starting on the left, terminating when the end of either branch is reached naturally.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, 3)
.interleave(Stream(4, 5, 6, 7))
.toList()
.let(::println) //[1, 4, 2, 5, 3, 6]
//sampleEnd
Do you like Arrow?
✖