> Quite a bit of SICP would be awkward to translate into a language that doesn't support TCO, such as Clojure.
>> Clojure doesn't have implicit tail call but it does have loop-recur and trampoline. SICP can be followed quite easily in Clojure.
>>> http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html....
This section relies on TCO. I realize that it could be translated, but I do not feel that this could be done without heavy modification. Besides that, basically the section's goal is to explain TCO.
Ah, I stand corrected. The last time I used Clojure (a few years ago), recur needed to be used with loop. That looks plenty close enough to the Scheme.
I disagree that the Ruby example is sufficient, though. Remember, SICP is intended as an introduction to programming. A chapter like this is useful to people who do /not/ understand TCO, recursion, and the stack already. Understanding it and using that knowledge to translate the exercises is different than having a shaky grasp lisp, scheme, and the "interpretation of computer programs"
>> Clojure doesn't have implicit tail call but it does have loop-recur and trampoline. SICP can be followed quite easily in Clojure.
>>> http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html.... This section relies on TCO. I realize that it could be translated, but I do not feel that this could be done without heavy modification. Besides that, basically the section's goal is to explain TCO.
This is the scheme implementation:
And this is the analogous(but not idiomatic) clojure: There are no heavy modifications.> Besides that, basically the section's goal is to explain TCO.
Now Ruby doesn't have TCO. But how does it stop you from understanding TCO, and how to implement them if the runtime supports it?I read SICP some time ago, and didn't do all the exercises, but as far as I recall, chapters 1-3 can easily be followed in Clojure, Ruby, JS...