I\'m trying to write a functional approach in scala to get a list of all numbers between 1 & 1000 that are divisible by 3 or 5
Here is what I have so far :
Looks like Brian beat me to it :)
Just thought I'd mention that a Stream might be more preferable here for better performance:
val x = (1 until 1000).toStream //> x : scala.collection.immutable.Stream[Int] = Stream(1, ?)
x filter (t=>(t%3==0)||(t%5==0)) //> res0: scala.collection.immutable.Stream[Int] = Stream(3, ?)