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

THE EXPLODE unfold a seed into a whole nesting — the anamorphism

To explode a cell is to grow structure out of it: from a single number — the depth D=4 — generate the entire nesting | < { [ ~ ~ ] } > |, cell by cell, on a flat seed. This is the anamorphism (an unfold): a corecursion that produces a structure from a seed by a rule, the exact dual of folding one up. Each position is filled by a rule — depth rises to the core, then falls — so the output is the palindrome tape, conjured from one integer. Its mirror is dart 338, the implode (the catamorphism, a fold): explode builds the many from the one; implode collapses the many back to one.

THE TECHNIQUE unfold depth D into the palindrome (anamorphism / corecursion)

The demo explodes the depth 4 into the full nesting — generated from a flat seed: live demo


HISTORY & CREDIT anamorphism (unfold) · 1991

“Structure has to be stored to exist.” — an unfold generates it from a seed and a rule; the whole nesting comes out of one number. cited

1991 · Meijer, Fokkinga & Paterson — “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire”: the recursion schemes, including the anamorphism (unfold).
corecursion · produce a structure from a seed by a coalgebra — the dual of structural recursion.
mirror · dart 338, the implode (catamorphism): build vs collapse.

One integer in, a whole nesting out, generated not stored. To explode is to unfold the many from the one. anamorphism, 1991

RECOMMEND FOR I-13 the unfold, on the compiler

On the canonical compiler, exploding depth 4 fills the tape so the core is 4,4 and the rim is 0 — the palindrome, generated:

$ i13 run d_explode.i13 # unfold depth 4 into the nesting RUN OK · 326 step(s) · peak stack 11 · call depth 11 core_l = 4 core_r = 4 -- the ~~ core, generated rim = 0 -- the outer | shell
Recommend: the explode is a genuine anamorphism on i13 — it generates the palindrome tape from the seed 4 by a depth rule, storing no template. That generate-not-store flavour is real — but it is the flavour of the Stern-Brocot keeper (computed-not-stored), so as a keeper candidate it re-instantiates an existing axis rather than opening a new one. Kept as the batch's build-half, mirror to the implode (dart 338): the anamorphism and the catamorphism, unfold and fold, the two directions of the same nesting.