mirror of
https://github.com/anoma/juvix.git
synced 2025-01-07 08:08:44 +03:00
60a191b786
* Adapts to https://github.com/anoma/juvix-stdlib/pull/86 * Adds a pass in `toEvalTransformations` to automatically inline all record projection functions, regardless of the optimization level. This is necessary to ensure that arithmetic operations and comparisons on `Nat` or `Int` are always represented directly with the corresponding built-in Core functions. This is generally highly desirable and required for the Geb target. * Adds the `inline: always` pragma which indicates that a function should always be inlined during the mandatory inlining phase, regardless of optimization level.
24 lines
365 B
Plaintext
24 lines
365 B
Plaintext
-- mutual recursion
|
|
module test023;
|
|
|
|
import Stdlib.Prelude open;
|
|
|
|
terminating
|
|
f : Nat → Nat
|
|
|
|
| x := if (x < 1) 1 (2 * x + g (sub x 1));
|
|
|
|
terminating
|
|
g : Nat → Nat
|
|
| x := if (x < 1) 1 (x + h (sub x 1));
|
|
|
|
terminating
|
|
h : Nat → Nat
|
|
| x := if (x < 1) 1 (x * f (sub x 1));
|
|
|
|
main : IO :=
|
|
printNatLn (f 5)
|
|
>> printNatLn (f 10)
|
|
>> printNatLn (f 20);
|
|
|