[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Left- and right-ness of folds

This page is part of the web mail archives of SRFI 44 from before July 7th, 2015. The new archives for SRFI 44 contain all messages, not just those from before July 7th, 2015.



On Fri, Oct 24, 2003 at 01:43:45PM -0700, oleg@xxxxxxxxx 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

Attachment: pgpHUTUqmhi2v.pgp
Description: PGP signature