arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / chunkMin
fun chunkMin(n:
Int
, allowFewerTotal:
Boolean
= true):
Stream
<
Chunk
<O>>
Outputs chunks of size larger than N
Chunks from the source stream are split as necessary.
If allowFewerTotal
is true,
if the stream is smaller than N, should the elements be included
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2).append { Stream(3, 4).append { Stream(5, 6, 7) } }
.chunkMin(3)
.toList()
.let(::println) //[Chunk(1, 2, 3, 4), Chunk(5, 6, 7)]
//sampleEnd
Do you like Arrow?
✖