
Transforming an accumulating mundane recursive fn into a tail-recursive fn - apgwoz
http://blog.fogus.me/2011/03/08/transforming-an-accumulating-mundane-recursive-fn-to-a-tail-recursive-fn-with-clojure/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+clojure+%28Planet+Clojure%29&utm_content=Twitter
======
eru
In Haskell, the decision gets more complicated. It's one of the few functional
languages, where you often want to avoid tail-recursion.

~~~
teaspoon
Maybe you're thinking of `foldl`, which happens to be tail-recursive. The
reason it's avoided is because it can unnecessarily eat up O(n) space due to
laziness. The issue is avoided by using the strict (and also tail-recursive)
`foldl'`.

~~~
eru
Yes. Or depending on what kind of result your fold should produce, you may be
better server with foldr, which actually benefits from lazyness.

