summaryrefslogtreecommitdiff
path: root/fib.kpl
blob: a90773912d67aa2c0676266db58d25c4b85d28d0 (plain)
1
2
3
4
5
6
7
8
9
10

// Fibonacci sequence for all numeric types

fib : Fn[n] $ (
    ? {
        n <= 0 { 0 }
        n < 3 { 2 }
        { `sync(fib; n - 1) + fib `sync n - 2 }
    }
)