1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/Compilation/positive/test009.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

23 lines
423 B
Plaintext

-- tail recursion
module test009;
import Stdlib.Prelude open;
sum' (acc : Nat) : Nat → Nat
| zero := acc
| (suc x) := sum' (suc x + acc) x;
sum : Nat → Nat := sum' 0;
fact' (acc : Nat) : Nat → Nat
| zero := acc
| (suc x) := fact' (acc * suc x) x;
fact : Nat → Nat := fact' 1;
main : IO :=
printNatLn (sum 10000)
>>> printNatLn (fact 5)
>>> printNatLn (fact 10)
>>> printNatLn (fact 12);