Fwd: A few half-baked ideas for SRFI 210 Marc Nieper-Wißkirchen 31 Aug 2020 16:20 UTC

---------- Forwarded message ---------
Von: Marc Nieper-Wißkirchen <xxxxxx@gmail.com>
Date: Mo., 31. Aug. 2020 um 18:17 Uhr
Subject: Re: A few half-baked ideas for SRFI 210
To: John Cowan <xxxxxx@ccil.org>
Cc: <xxxxxx@srfi.schemers.org>, <xxxxxx@srfi.schemers.org>, Adam
Nelson <xxxxxx@nels.onl>

I like these ideas, in particular in conjunction with SRFI 197! I've
put Adam and the SRFI 197 mailing list in CC.

In some sense, your proposal extends the syntax value/mv that is
already in SRFI 210, which just picks a particular value (read
"projection"). Give me a moment of time to think about a detailed
interface.

Further syntax (also related to pipelining), we should consider to add are:

(bind <producer> <transducer> ... <consumer>)

which is evaluated by evaluating all arguments and then by calling the
value of the first <transducer> with the values of <producer>, calling
the value of the next <transducer> with the resulting values and so on
until the the value of <consumer> is called to yield the final values.

Related is

(compose transducer ... transducer),

which is just multiple-value-aware composition (this doesn't have to
be syntax; it could be a procedure).

and

(bind* list transducer ... consumer)

which is a procedure evaluating

(bind (apply values list) transducer ... consumer)

Am Mo., 31. Aug. 2020 um 17:59 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
> These procedures will work well with SRFI 197 to provide glue, I think.
>
> Filter:  takes a producer, a predicate, and a consumer.  Values from the producer are sent to the consumer iff they satisfy the predicate, which takes both the index and the value.  We can specialize this to remove, take, drop, take-right, drop-right, take-while, drop-while easily.
>
> Map: takes a producer, a procedure, and a consumer, and does the obvious.  Should the procedure take both index and value also?
>
> Rearrange:  Takes a list of indices to rearrange the producer's values to the order the consumer expects.  Values with missing indices are dropped.  Should unknown indices get a specified default?  Some way to handle "all other values" like an improper list?
>
>
>
> John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
> Mos Eisley spaceport.  You will never see a more wretched hive of scum
> and villainy --unless you watch the Jerry Springer Show.
>         --georgettesworld.com
>
>