Here's what I got on PC with 128 MB RAM:
>> for m 1 20 1 [print ack 3 m]
13
29
61
125
253
509
** Internal Error: Stack overflow.
** Where: ack (:m - 1) 1
It worked ok with 0, 1, and 2 substituted for the "3" above.
Russell [EMAIL PROTECTED]
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 1999 3:30 PM
Subject: [REBOL] ackerman's function
> Here is Ackerman's function in REBOL
>
> ack: func [m n] [
> either zero? :m [:n + 1]
> [either zero? :n [ack (:m - 1) 1]
> [ack (:m - 1) ack :m (:n - 1)]]]
>
> The Ackermann function is the simplest example of a well-defined
> 'total function' which is computable but not 'primitive recursive'.
> What this means is that there is no iterative version with fixed
> bounds of iteration.
>
> I was hoping to try to benchmark it, but it causes a stack
> overflow (on A(3,8), which seems to be the standard values), and
> because it is not `primitive recursive', I can't figure out how
> to turn it into an `imperative' form to avoid stack death.
>
> Do all versions of REBOL use the same stack limit?
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>