aboutsummaryrefslogtreecommitdiffstats
path: root/progs/bench/fib.sy
blob: bd1aaa422d27c6d1f6b3e149cca8486cdade9f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
// 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.
fib(23) <=> 28657