Email list hosting service & mailing list manager

 First thoughts Marc Nieper-Wißkirchen (30 Mar 2020 06:39 UTC) Re: First thoughts John Cowan (30 Mar 2020 14:19 UTC) Re: First thoughts Marc Nieper-Wißkirchen (30 Mar 2020 17:12 UTC) Re: First thoughts Wolfgang Corcoran-Mathe (01 Apr 2020 13:56 UTC) Re: First thoughts Marc Nieper-Wißkirchen (01 Apr 2020 14:50 UTC) (missing) (missing) (missing) (missing) (missing) Re: First thoughts Marc Nieper-Wißkirchen (03 Apr 2020 09:27 UTC) Re: First thoughts Marc Nieper-Wißkirchen (01 Apr 2020 16:16 UTC) Re: First thoughts John Cowan (01 Apr 2020 16:37 UTC) Re: First thoughts Marc Nieper-Wißkirchen (01 Apr 2020 20:01 UTC) Re: First thoughts Wolfgang Corcoran-Mathe (02 Apr 2020 18:55 UTC) Re: First thoughts Marc Nieper-Wißkirchen (02 Apr 2020 19:38 UTC) Re: First thoughts Marc Nieper-Wißkirchen (03 Apr 2020 09:33 UTC)

Re: First thoughts Wolfgang Corcoran-Mathe 01 Apr 2020 13:56 UTC

```On 2020-03-30 19:12 +0200, Marc Nieper-Wißkirchen wrote:
>How the values are stored inside the Maybe is a question internal to the
>implementation.
>
>The generalization I am proposing means that `just' takes an arbitrary
>number of values and that `maybe-ref' may an arbitrary number of values to
>`success'. `proc's and `mproc's may take more than one value and may return
>more than one value.

Some thoughts about multiple values in SRFI 189:

* Would ‘maybe-ref/default’ require as many “default” arguments as
values contained in the “maybe” argument, or would it always return
a single default value in the Nothing case?  The former is sort of
reasonable assuming we could access the number of values stored in
a Just.

* How should multiple-value-storing Justs be compared with ‘maybe=’?
Presumably Justs j1 and j2 are equal in the sense of maybe= iff
j1 and j2 both return the same number of values and their values
are element-wise equal (in the sense of the comparison procedure
passed to maybe=).  Are there other complexities to be considered
here?

* How can ‘maybe-join’ handle Justs with multiple Just payloads?
e.g. would (maybe-join (just (just 1) (just 2))) return a value
equivalent to (just 1 2), or something else?

* Should ‘maybe-contains?’, ‘maybe-filter’, and ‘maybe-remove’
traverse the values of a multiple-value Just?  That is, could we
expect results like the following:

(maybe-contains? eqv? (just 'a 'b) 'b)  ; => #t

(maybe-filter boolean? (just 'a #t))    ; => (just 'a)

If these semantics were adopted, would it be consistent for
‘maybe-length’ to give the number of values contained in a Just?

* Would Either also allow multiple values?  (Presumably.)

It seems that it would be necessary for a Just to store the number
of values it contains along with the values themselves.  We could
expose the number of values contained in a Just, e.g. with
‘maybe-length’.

All in all, this is interesting, but seems to me to be a substantial
increase in complexity.  The possible semantics of some of these
procedures (especially ‘maybe=’ and the sequence operations) in the
presence of multiple-value Justs all seem pretty awkward.  It’s quite
possible that I’ve missed a better approach, though.

Regards,

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

"Conquering the galaxy is what bacteria with spaceships would
do--knowing no better, having no choice." --Greg Egan, _Disapora_
```