Re: Left- and right-ness of folds scgmille@xxxxxx 25 Oct 2003 04:09 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

Am I correct in saying then that a right fold would be defined even for
a directional datastructure such as a list?  This seems to be the case,
though it does imply that the right fold would naturally consume a
linear amount of storage in the worst case relative to the number of
values in a collection.

This would argue against a reversible attribute, at least for the
purposes of folding.  It would still be valid for get-right, however.

	Scott