Re:SICP Goodness – Why you don't need looping constructs
by shakna on Friday June 29, 2018 @07:36AM
(#17423867)
Tail calls were made explicit in Clojure, with the recur construct. It had more to do with the JVM than syntactic benefits, but it turns out to be a decent idea.
[ Parent
| on HN ]
Re:SICP Goodness – Why you don't need looping constructs
by junke on Friday June 29, 2018 @08:12AM
(#17424020)
"recur" can be used for self-call in tail position, but does not help with the general case where you may want to jump to another function.
Re:SICP Goodness – Why you don't need looping constructs
by steinuil on Friday June 29, 2018 @08:45AM
(#17424159)
Tail calls do not just deal with recursive functions, in general TCO works on any function call in tail position. Maybe a more general recur construct (maybe called "jump") would be a good idea, but then you'd have to remember to use it.
Re:SICP Goodness – Why you don't need looping constructs
by shakna on Friday June 29, 2018 @10:17AM
(#17424635)
Clojure is limited by the JVM, hence the need for recur. However, between it and trampoline you get most of the way to what TCO offers, albeit with the need for the programmer to be explicit.