You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
fib := method(n,
|
|
if(n <= 0) then(
|
|
return 0
|
|
) elseif(n == 1) then(
|
|
return 1
|
|
) else (
|
|
return fib(n-1) + fib(n-2)
|
|
)
|
|
)
|
|
|
|
fib(30) println
|
|
|
|
# time of fib(30)
|
|
# real 0m5.420s
|
|
# user 0m5.394s
|
|
# sys 0m0.020s
|
|
|
|
|