Mutual recursion is a computation in which two or more functions call one another. In Clojure, letfn makes the functions visible throughout the local binding chain, allowing forward and backward references. This supports self-contained recursive logic without moving private helper functions outside their enclosing function. section 3.1.3
Direct mutual recursion consumes a stack frame for each transition. Return the next call as a function, then use trampoline to invoke returned functions repeatedly until a non-function result appears. This converts the recursive sequence into tail-recursive iteration and avoids stack overflow for long runs. The function must eventually return a non-function value; otherwise trampoline recurses indefinitely. section 2.4.3
Alternating parity checks
letfn defines is-even? and is-odd? together. Each function returns a deferred call to the other, and trampoline drives the sequence: (trampoline is-odd? 120) returns false. The same pattern can model state machines, such as traffic-light transitions, where millions of transitions complete without consuming one stack frame per state. section 2.4.3
