Skip to content

Instantly share code, notes, and snippets.

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