summaryrefslogtreecommitdiff
path: root/Tools/LuaMacro/tests/test-lambda.lua
blob: 649b77d05cb2f98d5fd5786fc530dea6808f6289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require_ 'macro.lambda'
ok = pcall(require,'pl')
if not ok then return print 'test-lambda needs penlight' end
ls = List{10,20,30}
assert(ls:map(\x(x+1)) == List{11,21,31})
assert((\(42))() == 42 )

F = \x,y(x - y)

G = \x(F(x,10))

assert(G(11) == 1)

ls = List { (\(10,20,30))() }
assert(ls == List{10,20,30})