arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / repeat

repeat

fun repeat(): Stream<O>

Repeat this stream an infinite number of times. s.repeat() == s.append { s.append { s.append { ... } }

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream(1,2,3)
    .repeat()
    .take(8)
    .toList()
    .let(::println) // [1, 2, 3, 1, 2, 3, 1, 2]
//sampleEnd

Do you like Arrow?

Arrow Org
<