Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-WiÃkirchen 14 Jun 2020 20:57 UTC
Am So., 14. Juni 2020 um 22:30 Uhr schrieb John Cowan <firstname.lastname@example.org>: > > > > On Sun, Jun 14, 2020 at 3:25 PM Marc Nieper-Wißkirchen <email@example.com> wrote: > >> What do you think of the names >> >> `just->list' and `right->list' instead? If given a Nothing or a Left, they will return #f as a special case. It is an error to call them on any other value. > > > just->list would imply that it is an error to call it on a non-Just. I'll stick with "multitruth" even though it's a rather oddball word. If you want to go with such a long word, `list/false' is not longer, but maybe clearer. Why don't you like `->list*'? >> With the correct specification and implementation of `maybe-unfold' according to the protocol, a Scheme implementation can raise an error if >> >> (generator-unfold GEN maybe-unfold) >> >> is called on a generator of length 2 or more. > > > That pretty much decides me on this issue. I do *not* believe that it is an error to unfold into a fixed-size container from a generator that can deliver more values than the fixed size. In particular, there is nothing wrong with unfolding an infinite generator into a fixed-size container. The additional values available from the generator are simply never used for anything, That's not unfolding, the anamorphism, which `unfold` is supposed to be by SRFI 1. Anamorphisms have to exhaust their argument (as they potentially produce streams). > As for super-generators, they don't satisfy the generator protocol (which is specifically defined, unlike the unfold protocol), so I don't care how well or badly they work with generator-unfold. I didn't say that "super-generators" have to work with `generator-unfold`. They would have their own `super-generator-unfold`. But for such a thing to work, one needs a uniform unfold protocol. And even without a specified unfold protocol, it is pretty much clear what the correct definition is in the same way as it is clear that 1 shouldn't be considered a prime number.