Recently I added one more generator operator to Gauche, for I found its use case
and felt it's missing.

 -- Function: gflatten gen
     The argument GEN is a generator that yields lists.  This procedure
     returns a generator that first calls GEN to obtain a list, then yield
     its elements one at a time.  Once the list is exhausted, it calls GEN
     again and repeat the process.

It is similar to gconcatenate and gappend, but they operate on slightly
different domains.  Using Haskellish notation, their types can be described
as follows:

gconcatenate  :: Generator Generator a -> Generator a
gflatten            :: Generator [a] -> Generator a
(cut apply gappend <>) :: [Generator a] -> Generator a
gappend :: Generator a, Generator a, ... -> Generator a

If you feel it makes the spec bloated, I won't push it.  It can be written as
(lambda (g) (gconcatenate (gmap list->generator g)))



On Thu, Sep 3, 2015 at 12:07 PM, John Cowan <xxxxxx@mercury.ccil.org> wrote:
Arthur A. Gleckler scripsit:

> Unfortunately, the diff isn't useful because I made a mistake while
> removing the ^M characters added in your new version.  (It's okay to add
> them, but it would have been better to do that as a separate version.)
>  That means that every line appears in the diff.  I'll watch out for that
> in the future.

My fault.  I'll try to make sure that there never are any henceforth.  The -b
option I think suppresses ^M characters, though.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
Nobody expects the RESTifarian Inquisition!  Our chief weapon is
surprise ... surprise and tedium  ... tedium and surprise ....
Our two weapons are tedium and surprise ... and ruthless disregard
for unpleasant facts....  Our three weapons are tedium, surprise, and
ruthless disregard ... and an almost fanatical devotion to Roy Fielding....