!!
custom types
=> |% +$ shape $%([%box w=@] [%dot r=@]) -- =/ s `shape`[%box 5] ?- -.s %box w.s %dot r.s ==

each branch of a ?- can read that variant's own face.

glossary

=> sets the subject to its head, then evaluates its tail against it.

=>([a=1 b=2] b) is 2.

|% makes a core: a battery of named arms, each written ++ name.

reach an arm back out with =< or arm:core.

=<  a
|%
++  a  5
--

is 5.

^: turns a type into a factory gate that molds any noun to that type.

(^:(@ud) 5) is 5.

$% makes a head-tagged union: each case is a cell led by a @tas tag that picks it.

$%([%a p=@] [%b q=@]) is an %a cell or a %b cell.

$: 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=@.

=/ 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.

^- 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 ^-

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

?- switches on a tagged union, requiring a branch for every case - no default.

?-(& %.y 1 %.n 2) is 1.