[plt-scheme] any knows why Ackermann function definition in sicp is different from that in wikipedia ?

From: orzz (123orzz at gmail.com)
Date: Sat Sep 22 23:46:21 EDT 2007

(define (A x y)
  (cond ((= y 0) 0)
        ((= x 0) (* 2 y))
        ((= y 1) 2)
        (else (A (- x 1)
                 (A x (- y 1))))))

http://en.wikipedia.org/wiki/Ackermann_function

A(m,n)=
n+1               if m = 0
A(m-1,1)          if m > 0 and n = 0
A(m-1,A(m,n-1))   if m > 0 and n > 0

(define (A-WIKI m n)
  (cond  ((= m 0) (+ n 1))
        ((= n 0) (A-WIKI (- m 1) 1))
        (else (A-WIKI (- m 1)
              (A-WIKI m (- n 1))))))

all that confuse me.anyone give me a hand.thx!



Posted on the users mailing list.