trampoline library

Iteratively evaluates deferred computation steps to avoid recursive call-stack growth.

Represent each pending step with More and the final value with Done. A trampoline is synchronous, and the next step must be deferred inside More for the computation to remain stack-safe.

Classes

Bounce<T extends Object?>
Base class for computations in the trampoline pattern.
Done<T extends Object?>
Represents the final result of a bouncing computation.
More<T extends Object?>
Represents pending computation in the trampoline pattern.

Functions

trampoline<T>(Bounce<T> bounce) → T
Executes a bouncing computation until completion without recursion.