1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/Rust/Compilation/positive/test014.juvix

37 lines
539 B
Plaintext
Raw Normal View History

-- arithmetic
module test014;
import Stdlib.Prelude open;
f (x y : Nat) : Nat := x + y;
g (x y : Nat) : Nat := sub (x + 21) (y * 7);
h (f : Nat → Nat → Nat) (y z : Nat) : Nat := f y y * z;
x : Nat := 5;
y : Nat := 17;
func (x : Nat) : Nat := x + 4;
z : Nat := 0;
vx : Nat := 30;
vy : Nat := 7;
main : Nat :=
func (div y x)
+ -- 17 div 5 + 4 = 7
(y
+ x * z)
+ -- 17
(vx
+ vy * (z + 1))
+ -- 37
f
(h g 2 3)
4;
-- (g 2 2) * 3 + 4 = (2+21-2*7)*3 + 4 = 9*3 + 4 = 27+4 = 31