Module Sarek_ppx_lib.Sarek_tailrec_bounded

Bounded Recursion Inlining

val inline_bounded_recursion : string -> Sarek_typed_ast.tparam list -> Sarek_typed_ast.texpr -> int -> Sarek_ast.loc -> Sarek_typed_ast.texpr

Inline bounded recursion up to a maximum depth. This is used for non-tail-recursive functions with known bounds.

Note: max_depth is the value from the termination condition (e.g., if depth >= 4). We inline one extra level to ensure the base case is properly expanded.