sourcelibs/Graphs/demos/stations.xtl

1⍝!/usr/bin/env xetal 2⍝# A subway map written by its station names: g_raph< defines a variable 3⍝# per station and the map as a matrix when the program is compiled, so 4⍝# the program speaks of stations, not numbers. Run with "just demo Graphs stations". 5 6ᵍ⁼u̲se< "Graphs" 7"town" ᵍg̲raph< "airport-bridge-center-docks-exchange, fair-center-garden, docks-harbor"
ᵍg̲raph< expands to
airport ← 1
bridge ← 2
center ← 3
docks ← 4
exchange ← 5
fair ← 6
garden ← 7
harbor ← 8
town ← 8 8 r̲eshape 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0
8town 9center ⍝ its number 10town ᵍl̲evels center ⍝ stops from the center to each station 11harbor s̲elect town ᵍl̲evels airport ⍝ stops from the airport to the harbor