Merge pull request #33 from Productive2/master

Two new tests
This commit is contained in:
Mattia 2021-01-14 21:53:31 +01:00 committed by GitHub
commit b8346e5510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

21
tests/japl/interning.jpl Normal file
View File

@ -0,0 +1,21 @@
//compile time interning
var a = "hello";
var b = "hello";
print(a is b);//output:true
//runtime interning
var f = "leafy";
var g = "ishere";
var h = f + g;
var j = "leafyishere";
print(h is j);//output:true
//different strings
var x = "ex";
var y = "ey";
print(x is y);//output:false

View File

@ -0,0 +1,18 @@
var add2 = lambda(x)
{
return x + 2;
};
var sub2 = lambda(x)
{
return x - 2;
};
var mul2 = lambda(x)
{
return x * 2;
};
print(add2(sub2(mul2(sub2(5)))));
//5-2=3
//3*2=6
//output:6