diff options
Diffstat (limited to 'test.pez')
| -rw-r--r-- | test.pez | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -1,19 +1,19 @@ -@Box: {[value] +@Box: $[value] { dilambda[ - { value }, - {[new] value = new } + ${ value }, + $[new] { value = new } ] } -@Array2d: {[w, h] +@Array2d: $[w, h] { @data: array#new[w * h, 0] dilambda[ - {[x, y] data[x + (y * w)] }, - {[x, y, new] data[x + (y * w)] = new } + $[x, y] { data[x + (y * w)] }, + $[x, y, new] { data[x + (y * w)] = new } ] } -@print: {[x] printf["x -> %a\n", x] } +@print: $[x] { printf["x -> %a\n", x] } @x = Box[-7] x[] *= 2 print[x[]] @@ -27,7 +27,7 @@ FOR [@x: 0][< 10][+ 1] printf["%a == %a\n", m[3,7], 3^7] -@add: {[*] +@add: $[*] { @acc = 0 FOR [@i: 0][< SEL$][+ 1] acc += SEL[i] @@ -36,13 +36,11 @@ printf["%a == %a\n", m[3,7], 3^7] printf["4+1+3: %a\n", add[4,1,3]] -@gather: {[*] - SEL[*] -} +@gather: $[*] { SEL[*] } printf["test %a\n", gather[-1, (), 'x]] -@map: {[f, xs] +@map: $[f, xs] { @ys: array#new[xs.len] FOR [@i: 0][< xs.len][+ 1] ys[i] = f[xs[i]] @@ -51,7 +49,7 @@ printf["test %a\n", gather[-1, (), 'x]] printf["maps %a\n", map["abcd", #[1,2,0]]] -@inspect: {[m] +@inspect: $[m] { printf["%a\n", m] } @@ -60,6 +58,6 @@ r[0]=r printf["r: "] inspect[r] printf["r.a -> %a\n", r[0].a] -{ +${ inspect [#{0 3,"a" 3}] }[] |