Created
May 5, 2017 22:14
-
-
Save JorgeCastilloPrz/5e3c98200a3352bf5c4a7b27a6735449 to your computer and use it in GitHub Desktop.
asdk asokd kosadokas
This file contains hidden or 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 <T> filter(l: List<T>, res: List<T>, f: (T) -> Boolean): List<T> { | |
if (l.isEmpty()) { | |
return res | |
} else { | |
return filter(l.tail(), if (f(l.head())) { res + listOf(l.head())} else { res }, f) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment