mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-09 08:18:44 +00:00
Closure-pattern, infix references (interpretataion only)
This commit is contained in:
parent
c92555f7a8
commit
efea4901ef
8 changed files with 57 additions and 18 deletions
4
regression/orig/test062.log
Normal file
4
regression/orig/test062.log
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
> 5
|
||||
7
|
||||
12
|
||||
-2
|
||||
1
regression/orig/test064.log
Normal file
1
regression/orig/test064.log
Normal file
|
|
@ -0,0 +1 @@
|
|||
> 5
|
||||
20
regression/test062.expr
Normal file
20
regression/test062.expr
Normal 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
1
regression/test062.input
Normal file
|
|
@ -0,0 +1 @@
|
|||
5
|
||||
3
regression/test064.expr
Normal file
3
regression/test064.expr
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
infixr "++" at "+" (a, b) {return a+b}
|
||||
|
||||
write (infix "++" (2, 3))
|
||||
1
regression/test064.input
Normal file
1
regression/test064.input
Normal file
|
|
@ -0,0 +1 @@
|
|||
5
|
||||
Loading…
Add table
Add a link
Reference in a new issue