Test run and implementation note Wolfgang Corcoran-Mathe (21 Apr 2021 03:46 UTC)
Re: Test run and implementation note John Cowan (23 Apr 2021 15:57 UTC)
Re: Test run and implementation note Wolfgang Corcoran-Mathe (23 Apr 2021 18:21 UTC)

Re: Test run and implementation note Wolfgang Corcoran-Mathe 23 Apr 2021 18:21 UTC

On 2021-04-23 11:57 -0400, John Cowan wrote:
> On Tue, Apr 20, 2021 at 11:46 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> wrote:
>
> >     ((compose-left (cut gfilter even? <>)
> >                    (cut ggroup <> 5))
> >      (make-iota-generator 100))
> >
> > instead of the similar example in the SRFI document?
> >
>
> You certainly can.  But given c as a generator constructor and g1, g2 as
> operations, then ((compose-left g1 g2) (c)) seems much less perspicuous
> than (gcompose-left c g1 g2).  The right-composition case with
> (gcompose-right g2 g1 c) versus ((compose-right g2 g1) (c)) is less
> confusing, as at least it gets the right things in the right order, but
> still exposes additional machinery.

OK, that makes sense.

> Both of these return a generator.  It would be useful, however, to also
> allow the output to be captured by either a generator-consumer procedure
> (called once) or an accumulator procedure (called repeatedly) as well, thus
> returning a (typically) non-generator value.  Since all arguments are
> procedures, this would require a total of six composition procedures: two
> directions times three kinds of destinations.

So is the idea is to provide forms equivalent to

    (accumulate-generated-values acc (gcompose-left gproc ... gen))
    (accumulate-generated-values acc (gcompose-right gproc ... gen))
    (consumer (gcompose-left gproc ... gen))
    (consumer (gcompose-right gproc ... gen))

along with gcompose-left/-right?

I find it slightly worrying that these forms differ only in the number
of times that acc/consumer is called.  It's possible that this could
be a source of subtle bugs, as there's no way to distinguish an
accumulator from a consumer returning an unspecified value.

It seems like the general direction of all this is something like the
pipelines of SRFI 197, so I might suggest some variant on "gchain" for
the names of these forms.

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>

"Most learning is not the result of instruction.  It is rather the
result of unhampered participation in a meaningful setting."
--Ivan Illich