Closure-pattern, infix references (interpretataion only)

This commit is contained in:
Dmitry Boulytchev 2019-09-25 00:25:40 +03:00
parent c92555f7a8
commit efea4901ef
8 changed files with 57 additions and 18 deletions

View file

@ -0,0 +1,4 @@
> 5
7
12
-2

View file

@ -0,0 +1 @@
> 5

20
regression/test062.expr Normal file
View file

@ -0,0 +1,20 @@
fun a (x, y) {
local a = x + y, b = x - y;
{
local f = fun () {
write (x);
write (y);
write (a);
write (b)
};
a := 100;
b := 200;
x := 800;
y := 1000;
return f
}
}
a (5, 7) ()

1
regression/test062.input Normal file
View file

@ -0,0 +1 @@
5

3
regression/test064.expr Normal file
View file

@ -0,0 +1,3 @@
infixr "++" at "+" (a, b) {return a+b}
write (infix "++" (2, 3))

1
regression/test064.input Normal file
View file

@ -0,0 +1 @@
5