Skip to content

Instantly share code, notes, and snippets.

Last active Jul 12, 2019
What would you like to do?
fun <E> dropWhile(list: List<E>, f: (E) -> Boolean): List<E> {
tailrec fun loop(remaining: List<E>): List<E> =
when(remaining) {
is Empty -> remaining
is Cons -> if (f(remaining.head)) loop(remaining.tail) else remaining
return loop(list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment