arrow-fx-coroutines / arrow.fx.coroutines.stream / prependTo

prependTo

infix fun <A> Chunk<A>.prependTo(q: Queue<A>): Queue<A>

Prepends a chunk to the start of this chunk queue.

infix fun <O> Chunk<O>.prependTo(s: Stream<O>): Stream<O>

Prepends a Chunk onto the front of this stream.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  (Chunk(-1, 0) prependTo Stream(1, 2, 3))
  .toList().let(::println) // [-1, 0, 1, 2, 3]
//sampleEnd

infix fun <O> O.prependTo(s: Stream<O>): Stream<O>

Prepends a value onto the front of this stream.

import arrow.fx.coroutines.stream.*

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

infix fun <A> A.prependTo(fa: Iterable<A>): List<A>

Do you like Arrow?

Arrow Org
<