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

dropLast

fun dropLast(n: Int): Stream<O>fun dropLast(n: Long): Stream<O>

Outputs all but the last n elements of the input.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream.range(0..10)
    .dropLast(5)
    .toList()
    .let(::println) // [0, 1, 2, 3, 4]
//sampleEnd

Do you like Arrow?

Arrow Org
<