!!
higher-order
%+ roll `(list @)`~[1 2 3 4] |= [item=@ acc=@] (add item (mul 10 acc))

roll folds a gate across a list, left to right, carrying an accumulator.

each element becomes the next digit.

glossary

%+ calls a gate that takes two arguments.

%+(add 2 3) is 5.

irregular forms:

(gate a b) is %+(gate a b)

roll folds a gate across a list into one value, left to right.

(roll `(list @)`~[1 2 3 4] add) is 10.

^- casts a value to a named type: it checks the value fits and relabels it.

^-(@ 42) is 42.

irregular forms:

a leading backtick cast - the type in backticks, then the value - is ^-

list is the type of a null-terminated sequence.

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

:~ makes a null-terminated list.

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

irregular forms:

~[a b c] is :~(a b c)

|= makes a gate: a function with one named sample, then a body.

the body runs with the sample bound.

call the gate to run it.

(|=(a=@ (add a 1)) 4) is 5.

$: makes a tuple mold, naming each face in a cell.

$:(x=@ y=@) is the mold [x=@ y=@].

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

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

%: 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)

add sums two atoms.

(add 2 3) is 5.

mul multiplies two atoms.

(mul 3 4) is 12.