arrow-fx-coroutines / arrow.fx.coroutines.stream / intersperse
fun <A> Chunk<A>.intersperse(separator: A): Chunk<A>fun <O> Stream<O>.intersperse(separator: O): Stream<O>
Emits the specified separator between every pair of elements in the source stream.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, 3, 4, 5)
.intersperse(0)
.toList()
.let(::println) //[1, 0, 2, 0, 3, 0, 4, 0, 5]
//sampleEnd
Do you like Arrow?
✖