2 # Copyright (C) 2006-2009, Parrot Foundation.
5 # Ack by Leopold Toetsch
6 # Fib and Tak by Joshua Isom
7 # modified default value to n=3. Karl Forner
8 # ./parrot -Oc -R cgp-jit recursive.pir N
15 unless argc == 2 goto argsok
20 $P0.'recursion_limit'(100000)
23 array = new 'FixedFloatArray'
43 $I0 = TakInt($I0, $I1, n)
49 $N0 = TakNum(3.0, 2.0, 1.0)
52 $S0 = sprintf <<"END", array
57 Tak(3.0,2.0,1.0): %.1f
72 .tailcall ack($I0, $I1)
77 .tailcall ack($I4, $I3)
82 unless n < 2 goto endif
96 unless n < 2 goto endif
112 unless y >= x goto endif
117 $N0 = TakNum(tmp, y, z)
119 $N1 = TakNum(tmp, z, x)
121 $N2 = TakNum(tmp, x, y)
122 .tailcall TakNum($N0, $N1, $N2)
129 unless y >= x goto endif
134 $I0 = TakInt(tmp, y, z)
136 tmp = TakInt(tmp, z, x)
138 z = TakInt(tmp, x, y)
139 .tailcall TakInt($I0, tmp, z)
147 # vim: expandtab shiftwidth=4 ft=pir: