!!
puzzles-4
=< (m91 40) |% ++ m91 |= n=@ ?: (gth n 100) (sub n 10) (m91 (m91 (add n 11))) --

mccarthy

glossary

=< evaluates its head against its tail as subject.

=<(a b) is =>(b a), and =<(a [a=5]) is 5.

irregular forms:

arm:core is =<(arm core)

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

|% 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.

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

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

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

?: 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.

gth asks whether the first atom is strictly greater than the second.

(gth 5 3) is %.y.

sub subtracts the second atom from the first.

(sub 9 4) is 5.

add sums two atoms.

(add 2 3) is 5.