sourcedemos/rotate.xtl
1⍝!/usr/bin/env xetal
2⍝# Rotate along both axes: every frame moves the arrow one row down and
3⍝# one column right, wrapping around the edges of the board.
4⍝#
5⍝# Run it with ./demos/rotate.xtl or "xetal run demos/rotate.xtl". It
6⍝# prints eight frames separated by a blank line ("just animate" plays
7⍝# them). Read -1 o̲-₁₂ b: one rotation along axes 1 and 2 together.
8
9⍝# n u:f_rames b: prints board b and a blank line, then the next n - 1
10⍝# frames, each b rotated one row down and one column right; gives 0.
11ᵘf̲rames ← { n b →
12 n = 0 ? n
13 s ← p̲rint! b
14 gap ← p̲rint! ""
15 (n − 1) ᵘf̲rames -1 o̲-₁₂ b
16}
17⍝# The first frame: a 6 by 8 board of . with an arrow of # at its top left.
18arrow ← 6 8 r̲eshape ".#.......##.....###.....##......#......................."
19⍝# The result of drawing eight frames, bound so it is not printed.
20shown ← 8 ᵘf̲rames arrow