Last active
July 12, 2019 20:38
-
-
Save priort/878cb9d5e5a8f82492e93b32bc5a0990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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