Re: Left- and right-ness of folds scgmille@xxxxxx 25 Oct 2003 23:13 UTC
On Sat, Oct 25, 2003 at 01:55:56PM -0700, Bradd W. Szonye wrote:
> Bradd wrote:
> >> That's a big pitfall! A right-fold on an infinite sequence will
> >> diverge before the folding function ever gets called. I think it's a
> >> bad idea to provide an interface that is "broken by design" like that
> >> -- it cannot possibly function correctly.
>
> xxxxxx@freenetproject.org wrote:
> > Its not really.  collection-fold-right will raise an error if applied
> > to an infinite collection.  Would it placate you if it was required to
> > raise an error with truely infinite collections?
>
> That's better, but I still have a problem with the fact that you're
> requiring something that is not well-defined. And by "not well-defined,"
> I don't mean that it's ambiguous or unclear -- I mean that there's no
> way to define it meaningfully.

But its far less elegant to make specific exceptions.
After all, you're arguing over *what kind* of error occurs if someone
uses collection-fold-right is applied to an infinite collection.

	Scott