logoalt Hacker News

dreamcompilertoday at 12:55 AM0 repliesview on HN

Sigh. This again.

All major Common Lisps support tail call optimization with proper declarations, with the exception of ABCL because it runs on the JVM.

And those declarations are all identical or almost identical, so it's easy to write an implementation-specific macro to guarantee TCO if you need to do so.

Some algorithms are easiest to express and read with looping constructs. For those algorithms, use looping constructs. Other algorithms are easiest to express and read with recursion. For those, use recursion. You shouldn't be afraid of recursion just because ANSI doesn't say TCO is guaranteed. You should be afraid of it if your code needs to run on ABCL, but otherwise, recur on.