mirror of
https://github.com/anoma/juvix.git
synced 2025-01-07 08:08:44 +03:00
2baad15a41
* Enables new function syntax in local let-declarations * Closes #2251
19 lines
369 B
Plaintext
19 lines
369 B
Plaintext
-- Ackermann function
|
|
module test029;
|
|
|
|
import Stdlib.Prelude open;
|
|
|
|
ack : Nat → Nat → Nat
|
|
| zero n := n + 1
|
|
| (suc m) zero := ack m 1
|
|
| (suc m) (suc n) := ack m (ack (suc m) n);
|
|
|
|
main : IO :=
|
|
printNatLn (ack 0 7)
|
|
>> printNatLn (ack 1 7)
|
|
>> printNatLn (ack 1 13)
|
|
>> printNatLn (ack 2 7)
|
|
>> printNatLn (ack 2 13)
|
|
>> printNatLn (ack 3 7);
|
|
|