aboutsummaryrefslogtreecommitdiffstats
path: root/progs/bench/fib.sy
blob: 76c3af7667525444b974b96164c000b76e9d2b5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// The worst implementation of Fibonacci calculations
// possible. FYI, it can be done in constant time.
fib :: fn a:int -> int {
    if a < 2 {
        ret a
    }
    ret fib(a - 1) + fib(a - 2)
}
// 23 is around where things start getting slow.
start :: fn {
    //TODO pass arguments to skip debug printing. this test is very slow otherwise
    <!>
    // fib(23) <=> 28657
}