3 ms·
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.
by teaspoon 16y ago
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 16y agoYes. Or depending on what kind of result your fold should produce, you may be better server with foldr, which actually benefits from lazyness.