1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-07 08:08:44 +03:00
juvix/tests/Compilation/positive/test014.juvix
Łukasz Czajka 2baad15a41 Remove old function syntax (#2305)
* Enables new function syntax in local let-declarations
* Closes #2251
2023-08-24 16:24:47 +02:00

37 lines
588 B
Plaintext

-- arithmetic
module test014;
import Stdlib.Prelude open;
f (x y : Nat) : IO := printNatLn (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 : IO :=
printNatLn (func (div y x))
>> -- 17 div 5 + 4 = 7
printNatLn
(y + x * z)
>> -- 17
printNatLn
(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