Skip to content

Instantly share code, notes, and snippets.

@priort

priort/PersistTheList7.kt

Last active Jul 12, 2019
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
You can’t perform that action at this time.