[r6rs-discuss] [Formal] asymmetry between fold-left and fold-right

From: John Cowan <cowan>
Date: Mon Jan 29 01:57:15 2007

Anton van Straaten scripsit:

> Informally and intuitively, the fold-right procedure folds a procedure
> over the elements of a list in right-to-left order, whereas fold-left
> uses left-to-right order.

As a historical note, DTSS Lisp (the first Lisp I ever learned) defined
MINUS as a right-fold: (MINUS 5) = -5, (MINUS 3 4) = 3 - 4, (MINUS 3 4 5)
= (-3) + 4 + (-5). There was no left-folded subtraction function.

-- 
John Cowan   http://ccil.org/~cowan    cowan_at_ccil.org
We want more school houses and less jails; more books and less arsenals;
more learning and less vice; more constant work and less crime; more
leisure and less greed; more justice and less revenge; in fact, more of
the opportunities to cultivate our better natures.  --Samuel Gompers
Received on Mon Jan 29 2007 - 01:57:09 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC