Jonas Wissting <wiss@eelwing.arda> wrote:
+---------------
| In SICP Ackermans function is defined as:
|
| (define (A x y)
| (cond ((= y 0) 0)
| ((= x 0) (* 2 y))
| ((= y 1) 2)
| (else (A (- x 1)
| (A x (- y 1))))))
|
| And at http://mathworld.wolfram.com/AckermannFunction.html
|
| (define (real-A x y)
| (cond ((= x 0) (+ y 1))
| ((= y 0) (real-A (- x 1) 1))
| (else (real-A (- x 1)
| (real-A x (- y 1))))))
+---------------
The second is the more widely known, I think. See:
<URL:http://modulaware.com/mdlt08.htm>
<URL:http://pw1.netcom.com/~hjsmith/Ackerman/AckeWhat.html>
<URL:http://public.logica.com/~stepneys/cyc/a/ackermnn.htm>
[Note that the last of these *looks* different, because the left-hand-side
of some of the cases use "m+1" instead of "m". But when you account for the
offset, it's the same.]
However, some authors refer to a *three* argument function being the original
one, e.g., <http://www.cs.hmc.edu/~keller/rex.html#ack> says [or said, the
link appears broken]:
Ackermann's function ack(N, X, Y) returns the value of X op Y at
the Nth level of the hierarchy of ops +, *, pow, ...
Finally, J. Cowles and T. Bailey (Dept. of Comp. Sci., U. Wyoming) gave *many*
variations in <http://www.cli.com/ftp/pub/nqthm/nqthm-1987/ackermann.msg>,
but alas, this link is also broken. [I could post a cached copy, if anyone
really cares.]
But from the Cowles & Bailey paper, it would appear that Ackermann's
original 1928 version was a three-argument function, and that the
two-argument version of R. Peter (1935) is the same as the second
of the above. [SICP seems to be in the minority here.]
-Rob
-----
Rob Warnock, 41L-955 rpw3@sgi.com
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043