!!
puzzles-4
=< (powr 3 4) |% ++ powr |= [b=@ e=@] ?: =(e 0) 1 ?: =(0 (mod e 2)) =/ h (powr b (div e 2)) (mul h h) (mul b (powr b (dec e))) --

fast power

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.

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

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

mod is the remainder of a division.

(mod 17 5) is 2.

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

div divides, discarding the remainder.

(div 17 5) is 3.

mul multiplies two atoms.

(mul 3 4) is 12.

dec is decrement: one less than an atom.

(dec 8) is 7.