3 ms·
I don't think Clojure's "recur" or Scheme's tail-call elimination should really be called optimizations. The point of optimizations, AIUI, is that the code wil
by sethg 17y ago
I don't think Clojure's "recur" or Scheme's tail-call elimination should really be called optimizations.
The point of optimizations, AIUI, is that the code will still run with the optimizations off--it will just run more slowly, but might be useful in other ways (easier debugging, faster compilation, a chance to confirm that there are no bugs in the compiler/interpreter itself, whatever).
But if I'm using "recur" or tail-call elimination to write loops in a recursive form, and I know that my code has to still work even if those features are turned off, then all of a sudden I have to worry about things like "how many times can I recurse in this function without exhausting the stack?"
- jrockway 17y agoProgramming for a fixed amount of memory/stack is also an optimization.