split

fun <A> Iterable<A>.split(): Pair<List<A>, A>?(source)

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

import arrow.core.*

fun main(args: Array<String>) {
//sampleStart
val result =
listOf("A", "B", "C").split()
//sampleEnd
println(result)
}

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()})") }
}