mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
7 lines
222 B
Plaintext
7 lines
222 B
Plaintext
|
-- tail recursion: Fibonacci numbers in linear time
|
||
|
|
||
|
def fib' : Int -> Int -> Int -> Int := \(n : Int) \(x : Int) \(y : Int) if n = 0 then x else fib' (n - 1) y (x + y);
|
||
|
def fib : Int -> Int := \(n : Int) fib' n 0 1;
|
||
|
|
||
|
fib
|