1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/Core/positive/test011.jvc

11 lines
257 B
Plaintext

-- tail recursion: compute the n-th Fibonacci number in O(n)
def fib' := \n \x \y if n = 0 then x else fib' (n - 1) y (x + y);
def fib := \n fib' n 0 1;
def writeLn := \x write x >> write "\n";
writeLn (fib 10) >>
writeLn (fib 100) >>
writeLn (fib 1000)