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:
Anonymous2010-12-29 10:45
This english is trolling. No German would make english mistakes in this way.
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))
>>8 I do not see the difference. Both functions are called f
Well noted!
The proper tail recursive function would be
(define (tail-recursive-f n)
(if (= n 0)
1
(* n (tail-recursive-f (- n 1)))))