ocaml: phase 5.1 ackermann.ml baseline (ack(3, 4) = 125)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

Classic Ackermann function:

  let rec ack m n =
    if m = 0 then n + 1
    else if n = 0 then ack (m - 1) 1
    else ack (m - 1) (ack m (n - 1))

ack(3, 4) = 125, expanding to ~6700 evaluator frames — a useful
stress test of the call stack and control transfer. Real OCaml
evaluates this in milliseconds; ours takes ~2 minutes on a
contended host but completes correctly.

40 baseline programs total.
This commit is contained in:
2026-05-09 08:50:12 +00:00
parent 095bb62ef9
commit 70b9b4f6cf
3 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
let rec ack m n =
if m = 0 then n + 1
else if n = 0 then ack (m - 1) 1
else ack (m - 1) (ack m (n - 1))
;;
ack 3 4

View File

@@ -1,4 +1,5 @@
{
"ackermann.ml": 125,
"anagrams.ml": 3,
"bag.ml": 3,
"balance.ml": 3,