an essay on recursion · four voices

fugue

The same operation, repeated, builds something that contains itself. Four voices on the same subject — Bach, Church, transformer, Borges. Each voice plays the theme. Press, hear, run.

Each section below is a different language for the same shape. The shape is a fixed point — a value that survives being passed through a function, equal to its own image:

g = f(g)

In music, f is reflection in time. In λ-calculus, f is application. In a transformer block, f is addition of a residual. In the Library of Babel, f is enumeration. The voices arrive together.

1 · the crab canon

bach · BWV 1079

The Musical Offering, 1747. A single line played simultaneously forwards and backwards, two voices that meet in the middle and pass through each other. The score is a Möbius strip — turn it over and you have the same piece.

play it

0.0 s

2 · the y combinator

church · 1936

How does an anonymous function call itself? Pass it a copy of itself before it asks. The fixed-point combinator is the engine of recursion in the untyped λ-calculus — pure mechanism, zero machinery.

run it

3 · the residual stream

attention is all you need · 2017

A transformer block is x ↦ x + f(x). The output of every layer is the input plus a small refinement. The residual stream is a self-referential trace: each layer reads what previous layers wrote, adds its own annotation, passes the whole accumulating tape forward.

watch it accumulate

layer 0 / 6

4 · the library of babel

borges · 1941

"The Library is total. Its shelves contain all possible combinations of twenty-odd orthographic symbols (a number which, though extremely vast, is not infinite); that is, all that is given to express, in all languages." Somewhere in the Library: a perfect catalogue of the Library. Beside it, the inverse catalogue. Beside that, the catalogue of false catalogues.

request a page

25^3200 ≈ 10^4474 pages exist
click to request

coda · the same shape, four times

Each voice's interaction is an instance of the unifying equation. Map the equation to each voice and the structure becomes audible:

music
f := time-reversal · g := the line that equals its own retrograde
λ-calculus
f := λself.body · g := Y(f), the value that, applied, is f applied to itself
transformer
f := layer · g := x_n, the residual that has carried x₀ through every f_i
babel
f := enumeration · g := the Library, which contains the description of itself

Recursion presupposes only enumeration. The four voices end where they began.