fork download
  1. object Main {
  2. def main(args: Array[String]) {
  3. fib(0, 1) takeWhile {_ < 4000000} filter {_ % 2 == 0} sum
  4. }
  5.  
  6. def fib(x1: Int, x2: Int): Stream[Int] = {
  7. x1 #:: fib(x2, x1 + x2)
  8. }
  9. }
  10.  
Success #stdin #stdout 0.19s 381312KB
stdin
Standard input is empty
stdout
Standard output is empty