fork download
  1. object CurryTest extends Application {
  2.  
  3. def filter(xs: List[Int], p: Int => Boolean): List[Int] =
  4. if (xs.isEmpty) xs
  5. else if (p(xs.head)) xs.head :: filter(xs.tail, p)
  6. else filter(xs.tail, p)
  7.  
  8. def modN(n: Int)(x: Int) = ((x % n) == 0)
  9.  
  10. val nums = List(1, 2, 3, 4, 5, 6, 7, 8)
  11. println(filter(nums, modN(2)))
  12. println(filter(nums, modN(3)))
  13. }
  14.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty