Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def sieve(xs: List[Int]): List[Int] = xs match {
case xs if xs.isEmpty => Nil
case (x::xs) => x :: sieve(xs.filter(_ % x != 0))
}
println(sieve(Range(2, 100).toList))
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.