sourcedemos/arrays.xtl
1⍝!/usr/bin/env xetal
2⍝# Arrays: dense arrays, 1-origin indexing, the structural built-ins and
3⍝# scalar extension. Run it with "xetal run demos/arrays.xtl" (or
4⍝# "./demos/arrays.xtl"); it prints the result of each line after the
5⍝# definition of m: the matrix, its shape, a row, the last row, the
6⍝# matrix times ten, a row joined to more items and powers of ten.
7⍝# Read it for how r_eshape, s_elect, t_ake and c_at treat a matrix.
8
9⍝## The matrix
10
11⍝# m: a 2 by 3 matrix holding 1 to 6, row by row.
12m ← 2 3 r̲eshape r̲ange 6
13
14⍝## Structural built-ins and scalar extension
15
16m
17s̲hape m
182 s̲elect m
19-1 t̲ake m
20m × 10
21(f̲irst m) c̲at 7 8 9
2210 ^ o̲ffsets 3