Re: fxmapping-unfold(-maybe)
Wolfgang Corcoran-Mathe 11 Jun 2021 20:15 UTC
On 2021-06-11 20:02 +0200, Marc Nieper-Wißkirchen wrote:
> fxmapping-unfold and fxmapping-unfold-maybe should probably take an
> arbitrary number of seeds to allow multiple values piped through.
That makes sense to me, and it's not a big change.
> In any case, your example shows that the old unfold protocol (stemming from
> SRFI 1 and present in many SRFIs) should be revised. It's obviously not a
> good abstraction.
You mean the "three procedure" unfold,
(X-unfold stop? mapper successor seed)? Possibly so. I think there
are cases in which the separate procedures are useful, but the
equivalent Maybe/CPS version is often more efficient, as the SRFI
notes.
> PPS There's one more argument why the Maybe abstraction is a flawed one:
> With Maybe you can only simulate two callbacks. That suffers for the
> callback procedures in SRFI 224, but it won't in general. For consistency,
> one should focus on a protocol that is generalizable.
I don't fully understand. Is the argument that a binary sum type
isn't good because sometimes we want a ternary sum type, and so on?
I think it's clear that the "failure/success" paradigm shows up so
often as to be a useful pattern to capture, in its own right.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"This isn't right. This isn't even wrong." --Wolfgang Pauli