mirror of
https://github.com/anoma/juvix.git
synced 2024-12-14 17:32:00 +03:00
3fbc9c7c55
Closes #1644 #1635
18 lines
257 B
Plaintext
18 lines
257 B
Plaintext
module Fib;
|
|
|
|
type Nat :=
|
|
zero : Nat
|
|
| suc : Nat → Nat;
|
|
|
|
infixl 6 +;
|
|
+ : Nat → Nat → Nat;
|
|
+ zero b := b;
|
|
+ (suc a) b := suc (a + b);
|
|
|
|
fib : Nat -> Nat;
|
|
fib zero := zero;
|
|
fib (suc (zero)) := suc zero;
|
|
fib (suc (suc n)) := fib (suc n) + fib n;
|
|
|
|
end;
|