summaryrefslogtreecommitdiff
path: root/test.pez
blob: b6dcd8c0b3989dc7f5484b2412272dc889cbd469 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@Box: {[value]
    dilambda[
        { value },
        {[new] value = new }
   ]
}

@Array2d: {[w, h]
    @data: array#fill[w * h, 0]
    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]
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]

@add: {[*]
    @acc = 0
    FOR [@i: 0][< SEL$][+ 1]
        acc += SEL[i]
    acc
}

printf["4+1+3: %a\n", add[4,1,3]]