Re: Range procedures John Cowan 30 Jan 2016 18:16 UTC

Kevin Wortman scripsit:

> Yeah, I guess I thought the spirit of SRFI 121 generators was that they
> would be the lingua franca of R7RS-large sequences. So each subsequent
> sequence data type would simply provide a ->generator procedure,
> and client code would call that then use any of the many varied
> iteration procedures in SRFI 121. Specifying each of the filter, fold,
> etc. variations for every data structure seems IMO overly heavyweight.

It's heavyweight only in the sense that it involves a lot of names.
In normal implementations, internal iteration is more lightweight that
external iterators reified as procedures, though procedures are the most
lightweight kind of lazy sequences.  For one thing, external iterators
involve side effects, even if (as in Haskell) these side effects are
hidden inside the implementation.

However, I'll add ->generator functions where practicable, and I
will eventually issue a supplemental SRFI adding them for other data
structures.  Note that things like sets and hash tables, even though
they are not sequences, can still be converted to generators.

John Cowan
Please leave your values at the front desk.
                --sign in Paris hotel
Check your assumptions.  In fact, check your assumptions at the door.
                --Cordelia Vorkosigan