LOOPHOLE.DEV
CHAPTER I · THE PETIOLE
§I THE PETIOLE
01I

CONTROL ENTERS HERE

02I

A program is a leaf. The petiole is the entry; the apex is the return. Between them, every line of code is a vein.

enter(input) → leaf 03I

Read at the pace of breathing. The codex will wait. Each cell is closed; each chapter folds back upon itself.

// pause is also computation 04I
§II ITERATION AS BAMBOO
01II

Bamboo grows by node. Iteration grows by step. Each segment is a turn of the loop — identical, repeatable, complete.

02II
for (let i = 0; i < n; i++) {
  step(i);
}
03II

A node closes the previous segment and opens the next. The condition is a knot. The increment is the next stalk.

04II
while (cond) {
  body();
  advance();
}
05II

SEGMENT BY SEGMENT

06II

When the stalk hollows, control runs through it cleanly. The body is the work; the head and the tail are merely punctuation.

07II
for (item of grove) {
  cut(item);
}
08II
§III THE BRANCHING GINKGO

A ginkgo divides at the petiole. The left half is one truth; the right is another. Both leaves share a stem.

01III
if (light) {
  drift("left");
}
02III

The condition is the wind that decides which half lights up. Predicates choose; they do not invent.

03III
else {
  drift("right");
}
04III

ONE STEM · TWO LEAVES

05III

Branches are not opposites; they are siblings. The same petiole, the same leaf, two destinations.

06III
§IV THE RECURSIVE FERN
01IV
function factorial(n) {
  if (n <= 1) return 1;
  return n * factorial(n - 1);
}
02IV

A fern remembers its own shape at every scale. Recursion is the same shape, met again, smaller, until the smallest version returns the answer.

03IV

SELF AT EVERY SCALE

04IV

The base case is the smallest pinna — the leaflet that does not divide. Without it, the frond unrolls forever.

if (n <= 1) return 1; 05IV
§V THE PINE-NEEDLE PAIR
async threadA() {
  await draw(needle);
}
01VA

Two needles share one fascicle. They run in parallel, brushed by the same wind, but they do not become each other.

02VA

PAIRED · NEVER FUSED

03VA
async threadB() {
  await draw(needle);
}
04VB

A lock is the small enso that embraces a needle — for the duration of one breath, only one thread passes through it.

05VB
await Promise.all([
  threadA(), threadB()
]);
06VB
§VI THE LOTUS OF PURITY
f1
f2
f3
f4
f5
f6
f7
f8
const f = (x) => x;
// no global state
centerVI

A pure function is a lotus — the same input always produces the same output. There is no mud at the petal's edge.

§VII THE LOOPHOLE
01VII
function tail(n, acc) {
  if (n === 0) return acc;
  return tail(n - 1, acc * n);
}
02VII

EXIT VIA LOOPHOLE

03VII

The tea-leaf curls so its tip rejoins its own petiole. The loop is closed; the hole is the way out. Tail-call — a circle with a single opening.

04VII