module "/pliant/language/context.pli"

function ack m n -> r
  arg Int m n r
  if m=0
    return (n + 1)
  eif n=0
    return (ack m-1 1)
  else
    return (ack m-1 (ack m n-1))

gvar Str s_n := cast ((pliant_script_args translate Address 1) map CStr) Str
if (s_n parse (gvar Int n))
  console "Ack(3," n "): " (ack 3 n) eol
else
  console "usage: ack.pli <number>" eol