## [REBOL] Re: The Great Computer Language Shootout

### From: joel:neely:fedex at: 3-Jan-2002 16:57

Hi, Petr,
Petr Krenzelok wrote:

> For those interested in language comparisons, look at following
> site: http://www.bagley.org/~doug/shootout/
>
> If someone finds enough free time, ti would be interesting to see,
> how rebol scores :-)
>

I looked at this site a while back, but abandoned the effort of
running the tests in REBOL after the very first one failed to
complete...
The first test is the Ackermann function, computed for
a (3, 4) through a (3, 8). I coded the function in REBOL, and
got the following results:
a: func [x [integer!] y [integer!]] [
either x = 0 [
y + 1
][
either y = 0 [
a x - 1 1
][
a x - 1 a x y - 1
]
]
]

>> a 3 4

== 125

>> a 3 5

== 253

>> a 3 6

== 509

>> a 3 7

** Internal Error: Stack overflow
** Near: a x - 1 1

>>

I should include the remarks from the site itself that explain
the role of the Ackermann benchmark:
For this test, each program should be implemented in the same way.
Each program should implement the recursive version of Ackermann's
function illustrated below.
Ackermann's function is heavily recursive, and will really stress
a language's ability to do deep recursion. This test computes the
value of Ack(3, N), where N ranges up to 8. Visit the detail page
to see results for different values of N. Those languages that do
not implement tail recursion elimination (tail-call elimination)
will not peform as well as those that do.
This test also appears in the Kernighan and Wyk study Timing
Trials, or, the Trials of Timing: Experiments with Scripting and
User-Interface Languages, where they say it will give a language's
function call mechanism a workout. However, this probably isn't
so accurate for languages that do tail-call elimination, since
they essentially turn recursive tail-calls into iterative loops.
The correct output (for N = 4) looks like this:
Ack(3,4): 125
-jn-