repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
r18455 reverted.
[ruby-svn.git]
/
benchmark
/
bm_so_ackermann.rb
blob
7db5be9050ac56d6aebf28fa71f9f7436fed316f
1
#!/usr/bin/ruby
2
# -*- mode: ruby -*-
3
# $Id: ackermann-ruby.code,v 1.4 2004/11/13 07:40:41 bfulgham Exp $
4
# http://www.bagley.org/~doug/shootout/
5
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
15
16
NUM = 9
17
ack(3, NUM)
18
19