[erlang-questions] foldl vs foldr and ++

Wojciech Knapik <>
Fri May 11 00:06:41 CEST 2012


On Wed, May 09, 2012 at 12:00:29PM -0700, Andrew Ledvina wrote:

> My understanding is that foldl is preferred over foldr because it is
> tail recursive. 

Yes. But my uderstanding has always been that this preference has little
to do with performance. If anything, I'd expect the body-recursive
variant to be faster in most languages.

It's about memory consumption.

WK



More information about the erlang-questions mailing list