ThoughtStorms Wiki

New page : TailCallOptimization

Quora Answer : Do any programming language compilers automatically convert recursion to iteration?

Jul 4, 2017

This is tail-call optimization.

There are some functional languages where it's expected, rather than just a "nice add-on", on the grounds that when you have immutable data, recursion is the only way to run through a collection, and any serious programming language needs to be able to handle large (including infinite) collections which would crash the stack if recursion were handled naively.

That goes for languages like Haskell, Erlang, some Lisps, probably ML etc.

No Backlinks