◄ WORLD V · SONNY 5DART 338 · a helldive at the net

THE IMPLODE collapse the whole nesting to a single value — the catamorphism

To implode a cell — or the whole nesting — is to fold it inward to one value: sum every depth of [0,1,2,3,4,4,3,2,1,0] and the structure collapses to 20. This is the catamorphism (a fold): consume a structure by a rule, one cell at a time, until a single result remains. It is the exact dual of the explode (dart 329, the anamorphism): explode grew the many from the one, implode collapses the many back to one. Together they are the two directions of every nesting — build it up, tear it down — and their composition, unfold-then-fold, is the hylomorphism that computes without ever storing the structure between.

THE TECHNIQUE fold the whole nesting to one scalar (catamorphism)

The demo implodes the tape — folding every cell into a single sum: live demo


HISTORY & CREDIT catamorphism (fold) · 1991

“Reducing a structure needs it all in hand at once.” — a fold consumes it one cell at a time, carrying only the running result; the structure collapses to a value. cited

1991 · Meijer, Fokkinga & Paterson — the catamorphism (fold), the dual of the anamorphism.
hylomorphism · unfold then fold (explode ∘ implode) — compute through a structure never stored.
mirror · dart 329, the explode: build the many vs collapse to one.

Every depth summed, the nesting gone, one number left. To implode is to fold the many home into the one. catamorphism, 1991

RECOMMEND FOR I-13 the fold, on the compiler

On the canonical compiler, imploding the tape sums its depths to 20:

$ i13 run d_implode.i13 # fold the nesting to a scalar RUN OK · 193 step(s) · peak stack 11 · call depth 11 implode = 20 -- the whole nesting collapsed to one value
Recommend: the implode is a true catamorphism on i13 — a fold that collapses the nesting to 20. Not a keeper (a fold is coextensive with correctness; every correct reducer gives the same sum — the B39 convergence tell). Its worth is as the dual of the explode (329): together, unfold and fold are the batch's outermost structural pair — the anamorphism and the catamorphism, the way out and the way in of every nesting, meeting at the hylomorphism that needs no store between.