\ $Id: ackermann.bigforth,v 1.2 2001/06/25 00:34:05 doug Exp $
\ ackermann's function
\ http://www.bagley.org/~doug/shootout/
\ from James Hague

\ read NUM from last command line argument
0. argc @ 1- arg >number 2drop drop constant NUM

: ack  
   over 0=
   if nip 1+
   else
       dup 0=
       if drop 1- 1 recurse
       else
           1- over swap recurse  swap 1- swap recurse
       then
   then ;

\ run ack(3, NUM) and print result from stack
." Ack: " 3 NUM ack 1 u.r cr

bye