[plt-scheme] what is fold-left?

From: hendrik at topoi.pooq.com (hendrik at topoi.pooq.com)
Date: Thu Feb 12 14:54:00 EST 2009

On Wed, Feb 11, 2009 at 09:11:17PM -0600, Mike Eggleston wrote:
> Morning,
> I'm looking at some code at
> <http://funcall.blogspot.com/2007/08/naive-bayesian-classifier.html>. This
> code by default will not run in DrScheme. The code is using (fold-left
> ...). Looking at the function it looks like a (map ...), but I don't
> (yet) know why I can't just use a 'map' instead of the 'fold-left'.
> Any ideas? What does this function do that 'map' doesn't and why
> should it be used?

The name comes from Richard Bird's paper "A Theory of Lists", and he may 
have gotten it from ongoing discussins in IFIP WOrking Group 2.1 on 
Algorithmic Language.

There's also a fold-right, by the way.

-- hendrik

Posted on the users mailing list.