1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 05:42:26 +03:00
juvix/tests/Rust/Compilation/positive/test030.juvix
Paul Cadman b8cd84170b
Update juvix-stdlib to remove non-ASCII indentifiers (#2857)
This PR updates the juvix-stdlib to the current main commit which
includes:

* https://github.com/anoma/juvix-stdlib/issues/59
* https://github.com/anoma/juvix-stdlib/issues/101

All the Juvix test suite files and examples in this repo have been
updated to be compatible with the new stdlib.
2024-06-26 10:23:35 +02:00

24 lines
628 B
Plaintext

-- Ackermann function (higher-order definition)
module test030;
import Stdlib.Prelude open hiding {iterate};
iterate : {A : Type} → (A → A) → Nat → A → A
-- clauses with differing number of patterns not yet supported
-- iterate f zero x := x;
| f zero := id
| f (suc n) := f << iterate f n;
plus : Nat → Nat → Nat := iterate suc;
mult : Nat → Nat → Nat
| m n := iterate (plus n) m 0;
exp : Nat → Nat → Nat
| m n := iterate (mult m) n 1;
ackermann : Nat → Nat → Nat
| m := iterate λ {f n := iterate f (suc n) 1} m suc;
main : Nat := plus 3 7 + mult 3 7 + exp 3 7 + ackermann 2 13;