a guest Jan 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def filter(xs: List[Int], p: Int => Boolean): List[Int] =
- if (xs.isEmpty) xs
- else if (p(xs.head)) xs.head :: filter(xs.tail, p)
- else filter(xs.tail, p)
RAW Paste Data