Tracing Function Calls in OCaml
The #trace directive in OCaml’s interactive toplevel (ocaml or utop) logs function calls and returns, showing you exactly what arguments go in and what values come back out. This is invaluable for debugging recursive functions and understanding execution flow. Basic Usage Define a function and enable tracing with #trace: # let rec factorial n =…
