arrow-core-data / arrow.core / kotlin.sequences.Sequence / split

split

fun <A> Sequence<A>.split(): Pair<Sequence<A>, A>?

attempt to split the computation, giving access to the first result.

import arrow.core.split

fun main(args: Array<String>) {
  //sampleStart
  val result = sequenceOf("A", "B", "C").split()
  //sampleEnd
  result?.let { println("(${it.first.toList()}, ${it.second.toList()})") }
}

Do you like Arrow?

Arrow Org
<