Changeset 6501 for lang/scala

Show
Ignore:
Timestamp:
02/10/08 18:31:50 (7 years ago)
Author:
kmizu
Message:

fix bug

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/scala/sandbox/samples/misc/LazyFibonacci.scala

    r6093 r6501  
    33object LazyFibonacci extends Application { 
    44  val n = Console.readLine("> ").toInt 
    5   lazy val fib :LazyArray[Int] = lazyArray(for(i <- 0 to n) yield ( 
     5  lazy val fib :LazyArray[Int] = lazyArray(for(i <- 0 to n) yield delay{ 
     6    println(i); 
    67    if(i < 2) 1 else fib(i - 1).ref + fib(i - 2).ref 
    7   )) 
     8  }) 
    89  println("fib(" + n + ") = " + fib(n).ref) 
    910}