% $Id: ackermann.slang,v 1.0 2002/11/29 10:39:00 dada Exp $
% http://dada.perl.it/shootout/
%
% contributed by John E. Davis

define ack ();
define ack (M, N)
{
   !if (M)
     return( N + 1 );
   !if (N)
     return ( ack(M-1, 1) );
   return( ack(M-1, ack(M, N-1)) );
}


define main()
{
   variable NUM = integer (__argv[1]);
   vmessage ("Ack(3,%d): %d", (NUM, ack(3, NUM)));
}

main()