Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Created May 5, 2017 22:14
Show Gist options
  • Save JorgeCastilloPrz/5e3c98200a3352bf5c4a7b27a6735449 to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/5e3c98200a3352bf5c4a7b27a6735449 to your computer and use it in GitHub Desktop.
asdk asokd kosadokas
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