1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-07 16:22:14 +03:00
juvix/tests/Compilation/positive/test017.juvix
Łukasz Czajka 186f4f66ef
Tests for the new compilation pipeline (#1703)
Adds Juvix tests for the compilation pipeline - these are converted from
the JuvixCore tests (those that make sense). Currently, only the
translation from Juvix to JuvixCore is checked for the tests that can be
type-checked. Ultimately, the entire compilation pipeline down to native
code / WebAssembly should be checked on these tests.

Closes #1689
2023-01-12 11:22:32 +01:00

21 lines
367 B
Plaintext

-- tail recursion through higher-order functions
module test017;
open import Stdlib.Prelude;
sumb : Nat → (Nat → Nat → Nat) → Nat → Nat;
sumb acc f zero := acc;
sumb acc f (suc x) := f acc x;
terminating
sum' : Nat → Nat → Nat;
sum' acc x := sumb (x + acc) sum' x;
sum : Nat → Nat;
sum := sum' 0;
main : IO;
main := printNatLn (sum 10000);
end;