arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / range
fun range(range:
IntProgression
):
Stream
<
Int
>
Lazily produce the range [start, stopExclusive)
. If you want to produce
the sequence in one chunk, instead of lazily, use emits(start until stopExclusive)
.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream.range(0..20 step 2)
.toList().let(::println) // [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//sampleEnd
fun range(range:
LongProgression
):
Stream
<
Long
>
Lazily produce the range [start, stopExclusive)
. If you want to produce
the sequence in one chunk, instead of lazily, use emits(start until stopExclusive)
.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream.range(0L..15 step 3)
.toList().let(::println) // [0, 3, 6, 9, 12, 15]
//sampleEnd
fun range(range:
CharProgression
):
Stream
<
Char
>
Lazily produce the range [start, stopExclusive)
. If you want to produce
the sequence in one chunk, instead of lazily, use emits(start until stopExclusive)
.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream.range('a'..'z' step 2)
.toList()
.let(::println) // [a, c, e, g, i, k, m, o, q, s, u, w, y]
//sampleEnd
Do you like Arrow?
✖