mirror of
https://github.com/anoma/juvix.git
synced 2024-12-20 13:21:47 +03:00
16 lines
263 B
Plaintext
16 lines
263 B
Plaintext
|
module Fibonacci;
|
|||
|
|
|||
|
open import Stdlib.Prelude;
|
|||
|
|
|||
|
fib : ℕ → ℕ → ℕ → ℕ;
|
|||
|
fib zero x1 _ ≔ x1;
|
|||
|
fib (suc n) x1 x2 ≔ fib n x2 (x1 + x2);
|
|||
|
|
|||
|
fibonacci : ℕ → ℕ;
|
|||
|
fibonacci n ≔ fib n 0 1;
|
|||
|
|
|||
|
main : IO;
|
|||
|
main ≔ putStrLn (natToStr (fibonacci 25));
|
|||
|
|
|||
|
end;
|