Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"tail recursion" SICP problem

Name: Anonymous 2010-12-29 10:34

Hello.

I read SICP and I find it hard to understand the "tail recursion". He says the book, which is a function of "tail recursion"as he calls himself, and not the other functions. But she does not "tail recursion":

(define (f n)
           (if (= n 0)
             1
             (* n (f (- n 1)))))

This is the "else branch"is called. What's up?

(To my English, forgive me am German makes happily speaks, because I, and to the English.)

Name: Anonymous 2010-12-29 11:55

Y combinator version would be

(lambda (n)
  ((((lambda (f)
       (lambda (n)
         (lambda (a)
           (if (<= n 0) a
               (((f f) (- n 1)) (* a n))))))
     (lambda (f)
       (lambda (n)
         (lambda (a)
           (if (<= n 0) a
               (((f f) (- n 1)) (* a n))))))) n) 1))


I feel the lack of SATORI on /prog/ these days.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List