• Executes a trampoline computation until a final (non-thunk) result is obtained.

    The trampoline function repeatedly invokes the deferred computations (thunks) in an iterative loop. This avoids deep recursive calls and prevents stack overflow, which is particularly useful for implementing recursion in a stack-safe manner.

    Type Parameters

    • T

      The type of the final result.

    Parameters

    • initial: Trampoline<T>

      The initial Trampoline value or thunk to start execution from.

    Returns T

    The final result of the computation (a non-thunk value).