It does preclude it, but clojure found an arguably elegant solution to it, using recur[1] instead. As a plus, in addition to achieving the same result as tail-call elimination, it does check that the call is indeed in tail position, and also works together with loop[2].For me, it made me not miss tail-call elimination at all.
[1] https://clojuredocs.org/clojure.core/recur
[2] https://clojuredocs.org/clojure.core/loop
lispm|2 years ago
Looping construct in most languages provides a simple conversion of self recursion (a function calls itself recursively) to a loop: update the loop variables and then do the next loop iteration.
But the general case of tail calls is not covered by a simple local loop, like what is provided by Clojure.
whateveracct|2 years ago
packetlost|2 years ago
Aside from that, I agree. Tail-call optimization's benefits are wildly overblown.
whateveracct|2 years ago