sourceextensions/hello/demos/tour.xtl
1⍝# A tour of the hello extension: X_eTaL arrays handed to Rust and back.
2⍝# Run: just demo hello tour (or: xetal-x --ext extensions/hello run demos/tour.xtl)
3
4ʰˣ⁼u̲se< "Hello"
5
6⍝ Rust answers, upper-cases and adds.
7ʰˣa̲nswer @
8ʰˣs̲hout "hello from x_etal, à la rust"
91.5 ʰˣa̲dd 2.25
10
11⍝# A 10 by 10 times table crosses the boundary as one array, summed in
12⍝# Rust: 55 squared.
13t ← (r̲ange 10) '× t̲able r̲ange 10
14ʰˣs̲um t
15
16⍝# A rank-3 array goes out and comes back with its shape intact.
17c ← 2 3 4 r̲eshape r̲ange 24
18s̲hape ʰˣe̲cho c
19(f̲loat c) m̲atch ʰˣe̲cho c