!!
puzzles-2
=| acc=(list @) =/ n 5 |- ?: =(n 0) acc $(acc [n acc], n (dec n))

which way out?

glossary

=| pins a name at its type's default value (its bunt) - often an accumulator starting at zero.

=|(n=@ n) is 0.

$= wraps a mold with a face, naming the value it produces.

$=(x @) is the mold x=@.

list is the type of a null-terminated sequence.

(list @) is a list of atoms; the empty list is ~.

=/ pins a named value (a face) into the subject for the lines below it.

name=value optionally declares the type.

=/(a 3 (add a a)) is 6.

|- makes a trap and runs it at once.

inside, $ restarts it with new values - this is how you loop.

=/(a 3 |-(?:(=(a 0) 7 $(a (dec a))))) is 7.

?: is if-then-else: it picks its first branch when the test is yes, the second when no.

?:((gth 3 5) 10 20) is 20.

.= tests two nouns for equality, giving a loobean.

.=(3 3) is %.y, and .=(3 4) is %.n.

irregular forms:

=(a b) is .=(a b)

%= resolves a wing with some faces changed.

=/(a [x=1 y=2] a(x 9)) is [x=9 y=2].

irregular forms:

a(x 9) is %=(a x 9)

$(a b) restarts a loop with a changed to b

:* makes a tuple of many elements, nesting to the right.

:*(1 2 3) is [1 2 3].

irregular forms:

[a b c d] is :*(a b c d)

%: calls a gate with several arguments, gathering them into one sample.

%:(add 2 3) is 5.

irregular forms:

(gate a b c) is %:(gate a b c)

dec is decrement: one less than an atom.

(dec 8) is 7.