Re: Left- and right-ness of folds scgmille@xxxxxx 25 Oct 2003 03:54 UTC
On Fri, Oct 24, 2003 at 01:43:45PM -0700, xxxxxx@pobox.com wrote:
>
> I would like to remark that 'left' and 'right' in the traditional
> fold-left and fold-right do *not* refer to the order in which the
> elements of a collection are fetched: from the left or from the
> right. Rather, these labels refer to associativity. Let us consider an
> ordered collection, e.g., a list of three elements (e1 e2 e3). Then
>
> fold-left  opl seed lst ===  (((seed `opl` e1) `opl` e2) `opl` e3)
>
> fold-right opr seed lst ===  (e1 `opr` (e2 `opr` (e3 `opr` seed)))

<snip>

Ah.  That is most enlightening as always.  Bradd, I believe this means
you'll have to add

(define collection-fold collection-fold-left)

to your code. :)

	Scott