interleave
interleave both computations in a fair way.
import arrow.core.*
fun main(args: Array<String>) {
//sampleStart
val tags = List(10) { "#" }
val result =
tags.interleave(listOf("A", "B", "C"))
//sampleEnd
println(result)
}
Content copied to clipboard
interleave both computations in a fair way.
import arrow.core.interleave
fun main(args: Array<String>) {
//sampleStart
val tags = generateSequence { "#" }.take(10)
val result =
tags.interleave(sequenceOf("A", "B", "C"))
//sampleEnd
println(result.toList())
}
Content copied to clipboard