Trains
Unlike in many other APLs, trains in TinyAPL are written using special syntax: ⦅, ⋄and ⦆. They are a sequence of arrays, functions, adverbs and conjunctions that combine to create functions or modifiers.
Note that, if a train has no diamonds, the contents are parsed with a special syntax where function application doesn't exist (but modifier application does), and then each tree becomes a tine. This means that, in most cases, you can omit diamonds in trains, making a Compact Train: ⦅+-×⦆ for ⦅+⋄-⋄×⦆ .
1-trains
The simplest train is the 1-train:
⦅x⦆isx⍨;⦅F⦆isF;u _⦅_A⦆isu _A;u _⦅_C_⦆_ visu _C_ v;
2-trains
⦅x⋄y⦆isx⍨⦅x⋄G⦆isx∘G⦅F⋄y⦆isF∘y⦅F⋄G⦆isF∘G⦅x⋄_A⦆isx _A⦅F⋄_A⦆isF _Au _⦅_A⋄G⦆is(u _A)∘Gu _⦅_A⋄_B⦆is(u _A) _Bu _⦅_A⋄_C_⦆is(u _A) _C_ u*should this be changed to Over-like(u _A) _C_ (v _A)?u _⦅x⋄_C_⦆isx _C_ uu _⦅F⋄_C_⦆isF _C_ uu _⦅_C_⋄y⦆isu _C_ yu _⦅_C_⋄G⦆isu _C_ Gu _⦅_C_⋄_A⦆_ vis(u _C_ v) _Au _⦅_C_⋄_D_⦆_ vis(u _C_ v)∘(u _D_ v)
3-trains
⦅x⋄y⋄z⦆isy⍨⦅x⋄y⋄H⦆isy⍨⦅F⋄y⋄x⦆isy⍨⦅F⋄y⋄H⦆isy⍨⦅F⋄G⋄H⦆isF«G»H⦅x⋄G⋄H⦆is(x∘G)∘H⦅F⋄G⋄z⦆is(G∘z)∘F⦅x⋄G⋄z⦆is(x G z)⍨⦅x⋄_C_⋄z⦆isx _C_ z⦅x⋄_C_⋄H⦆isx _C_ H⦅F⋄_C_⋄z⦆isF _C_ z⦅F⋄_C_⋄H⦆isF _C_ Hu _⦅_A⋄G⋄H⦆is(u _A)«G»Hu _⦅_A⋄_B⋄_C⦆is((u _A) _B) _Cu _⦅x⋄_C_⋄_A⦆isx _C_ (u _A)u _⦅F⋄_C_⋄_A⦆isF _C_ (u _A)u _⦅_A⋄_C_⋄z⦆is(u _A) _C_ zu _⦅_A⋄_C_⋄H⦆is(u _A) _C_ Hu _⦅F⋄G⋄_C_⦆_ visF«G»(u _C_ v)u _⦅x⋄G⋄_C_⦆_ vis(x∘G)∘(u _C_ v)u _⦅_C_⋄G⋄H⦆_ vis(u _C_ v)«G»Hu _⦅_C_⋄G⋄_D_⦆_ vis(u _C_ v)«G»(u _D_ v)u _⦅_A⋄_B⋄H⦆_ vis(u _A)«(v _B)»Hu _⦅_C_⋄_A⋄_B⦆_ vis((u _C_ v) _A) _Bu _⦅x⋄_C_⋄_D_⦆_ visx _C_ (u _D_ v)u _⦅F⋄_C_⋄_D_⦆_ visF _C_ (u _D_ v)u _⦅_A⋄_C_⋄_B⦆_ vis(u _A) _C_ (v _B)u _⦅_A⋄_C_⋄_D_⦆ vis(u _A) _C_ (u _D_ v)u _⦅_C_⋄_D_⋄z⦆_ vis(u _C_ v) _D_ zu _⦅_C_⋄_D_⋄H⦆_ vis(u _C_ v) _D_ Hu _⦅_C_⋄_D_⋄_A⦆_ vis(u _C_ v) _D_ (v _A)u _⦅_C_⋄_D_⋄_E_⦆_ vis(u _C_ v) _D_ (u _E_ v)
Longer trains
Longer trains are parsed right-to-left, two tines at a time, creating 3-trains; the result of an evaluation becomes the rightmost tine of the next group. If only a tine is left it is used to create a 2-train. If the left tine of a 3-train is empty, it becomes a 2-train, which can be useful to force a chain of functions to be an Atop instead of a Fork. To use an empty tine in a compact train, you can use the special token · instead.