Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / ackermann.ruby
blob801fcdbbcea8fc837591b2719c4b5a7f3b4a73ed
1 #!/usr/bin/ruby
2 # -*- mode: ruby -*-
3 # $Id: ackermann.ruby,v 1.2 2005-06-10 00:57:22 igouy-guest Exp $
4 # http://www.bagley.org/~doug/shootout/
6 def ack(m, n)
7 if m == 0 then
8 n + 1
9 elsif n == 0 then
10 ack(m - 1, 1)
11 else
12 ack(m - 1, ack(m, n - 1))
13 end
14 end
16 NUM = Integer(ARGV.shift || 1)
17 print "Ack(3,", NUM, "): ", ack(3, NUM), "\n"