Hello all,


Linus thanks for this contribution the SRFI process.


As you might know, both srfi-167 (okvs) and srfi-168 (nstore)
rey on srfi-158 (scheme generators).

My needs were mostly covered by scheme generators. I added
two helpers generator-scatter and nstore-query.

generator-scatter will unroll a generator of generators as flat generator.

nstore-query will chain generators operations. Here is the
implementation:

    (define-syntax nstore-query
      (syntax-rules ()
        ((_ value) value)
        ((_ value f rest ...)
         (nstore-query (f value) rest ...))))

It is like compose for generators. With that one ends up coding things like:

(generator->list (nstore-query (list->generator (iota 10))
                         (lambda (g) (gfilter odd? g))))

Which is similar to the following transducer:

(transduce (tfitler odd?) (iota 10))

It seems to me transducers can be implemented in terms of generators.
And that the point of transducers it makes it easy to compose operations
on list (but similarly on generators too) using high order functions unlike
scheme generator.

I am wondering whether transducers would not be better implemented
as an extension to scheme generator aka. srfi-158. Or something in like that.