raulraja
12/27/2018, 12:26 PMimport arrow.data.NonEmptyList
fun <A> NonEmptyList<A>.firstRest(): Pair<A, List<A>> =
head to tail
fun <A> Iterable<A>.firstRest(): Pair<A?, List<A>> =
firstOrNull() to drop(1)
benfleis
12/27/2018, 8:24 PM.first()
in this case. (My constraints are stdlib atm…)raulraja
12/27/2018, 8:49 PMIterable<A>
is probably the closest just using the std lib while remaining pure for their immutable impls.benfleis
12/27/2018, 9:47 PM