Yields all values from the iterator
to the Iterator being built and suspends until all these values are iterated and the next one is requested.
The sequence of values returned by the given iterator can be potentially infinite.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() {
val sequence = sequence {
val start = 0
yield(start)
yieldAll(1..5 step 2)
yieldAll(generateSequence(8) { it * 3 })
}
println(sequence.take(7).toList())
}
Target: JVMRunning on v.2.1.20
Yields a collections of values to the Iterator being built and suspends until all these values are iterated and the next one is requested.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() {
val sequence = sequence {
val start = 0
yield(start)
yieldAll(1..5 step 2)
yieldAll(generateSequence(8) { it * 3 })
}
println(sequence.take(7).toList())
}
Target: JVMRunning on v.2.1.20
Yields potentially infinite sequence of values to the Iterator being built and suspends until all these values are iterated and the next one is requested.
The sequence can be potentially infinite.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() {
val sequence = sequence {
val start = 0
yield(start)
yieldAll(1..5 step 2)
yieldAll(generateSequence(8) { it * 3 })
}
println(sequence.take(7).toList())
}
Target: JVMRunning on v.2.1.20