From 124972dd5216da7935cf3a928bf6d94e4d6ce833 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 10 Oct 2022 11:09:00 +0200 Subject: dilambdas and such --- test.pez | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'test.pez') diff --git a/test.pez b/test.pez index 118be00..d01ea10 100644 --- a/test.pez +++ b/test.pez @@ -1,21 +1,29 @@ -@print: {[x] printf["%a\n", x]} - @Box: {[value] - @it = 0 - ( - @test = 7 - @h2 = 100 - it = #[{value}, - {[new] printf["test: %a\n", test] value = new}] - ) - ( - @hmm = 999 - ) - it + dilambda[ + { value }, + {[new] value = new } + ] } +@Array2d: {[w, h] + @data: array#fill[w * h, 0] + @w = w + dilambda[ + {[x, y] data[x + (y * w)] }, + {[x, y, new] data[x + (y * w)] = new } + ] +} +@print: {[x] printf["x -> %a\n", x] } @x = Box[-7] -print[x[0][]] -x[1]['awesome] -print[x[0][]] +x[] *= 2 +print[x[]] +x[] = 'abcdef +print[x[]] + +@m: Array2d[10, 10] +FOR [@x: 0][< 10][+ 1] + FOR [@y: 0][< 10][+ 1] + m[x, y] = x ^ y + +printf["%a == %a\n", m[3,7], 3^7] -- cgit v1.2.3