Email list hosting service & mailing list manager

Maybe macros John Cowan (26 Jun 2020 17:16 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (26 Jun 2020 17:43 UTC)
Re: Maybe macros John Cowan (26 Jun 2020 18:48 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (26 Jun 2020 18:57 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 04:29 UTC)
Re: Maybe macros Arthur A. Gleckler (26 Jun 2020 19:50 UTC)
Re: Maybe macros John Cowan (26 Jun 2020 19:52 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 03:44 UTC)
Re: Maybe macros Arthur A. Gleckler (27 Jun 2020 03:59 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 04:15 UTC)
Re: Maybe macros Arthur A. Gleckler (27 Jun 2020 04:29 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (27 Jun 2020 14:09 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 18:55 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (27 Jun 2020 20:46 UTC)
Re: Maybe macros John Cowan (27 Jun 2020 21:34 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 17:26 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 17:43 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 18:52 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 20:24 UTC)
Re: Maybe macros John Cowan (28 Jun 2020 18:54 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 20:21 UTC)
Re: Maybe macros Alex Shinn (29 Jun 2020 00:02 UTC)
Re: Maybe macros Marc Nieper-Wißkirchen (29 Jun 2020 06:23 UTC)
Re: Maybe macros Wolfgang Corcoran-Mathe (28 Jun 2020 16:54 UTC)

Re: Maybe macros Wolfgang Corcoran-Mathe 27 Jun 2020 14:09 UTC

I also suggest the addition of the follow Either macros, with
semantics analogous to those of the Maybe macros:

* (either-and either-expr ...)
* (either-or either-expr ...)
* (either-let* (claw ...) body)

It might be objected that the either-and/-or forms make less sense
than their Maybe counterparts, since the latter are, in a sense,
translations of Scheme and/or to the "Maybe protocol".  These macros
are not merely logical operations, though; they have a control role
similar to that of SRFI 165's computation-each (and Haskell's >>
or sequence_).

This SRFI lacks maybe-/either-each and -each-in-list procedures
analogous to those of SRFI 165, and the reason for this seems clear
to me; as Scheme *procedures*, they aren't very useful.  Following
165, the expression

    (maybe-each-in-list maybes)

would simply return Nothing if one occurred among the maybes, and
the value of the last element of maybes otherwise.  This is just
list-searching,[*] and is roughly equivalent to

    (truth->maybe (every just? maybes)).

While this isn't very useful, I believe there are many cases in
which we would like to sequentially evaluate Maybe/Either-valued
*expressions* until we hit Nothing/a Left.  The Schemely solution
is to provide the -and, -or, and -let* macros for both Maybe and
Either.

Regards,

Wolfgang

[*] Incidentally, either-each seems more useful; no similar one-liner
comes to mind for getting the first Left and otherwise the last
Right of a list of Eithers.

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

"If one is searching for a needle in a haystack, look in the part
of the haystack that contains more needles." --Bird & Wadler