mirror of
https://github.com/anoma/juvix.git
synced 2024-12-20 05:12:05 +03:00
2baad15a41
* Enables new function syntax in local let-declarations * Closes #2251
12 lines
249 B
Plaintext
12 lines
249 B
Plaintext
module Fibonacci;
|
|
|
|
import Stdlib.Prelude open;
|
|
|
|
fib : Nat → Nat → Nat → Nat
|
|
| zero x1 _ := x1
|
|
| (suc n) x1 x2 := fib n x2 (x1 + x2);
|
|
|
|
fibonacci (n : Nat) : Nat := fib n 0 1;
|
|
|
|
main : IO := readLn (printNatLn ∘ fibonacci ∘ stringToNat);
|