Sounds good to me.   So the list of new macros is maybe-and, maybe-or, maybe-and-let* (more verbose but clearer), and their either-* analogues. I'll add these to SRFI 189 when I have a chance.

I don't think we need -each-in-list if we define -and to work that way: it returns the first Nothing/Left if there is one, or the last Just/Right if there isn't.  This is exactly how standard Scheme `and` works.  If there are no arguments, you get a wrapped #t.

Of course -or is the dual: it returns the first Just/Right if there is one, and the last Nothing/Left if there isn't.  (There is no need to say "last" in R7RS-small, because there is only one #f).  If there are no arguments, you get Nothing or (I suppose) Left #f.

On Sat, Jun 27, 2020 at 10:09 AM Wolfgang Corcoran-Mathe <> wrote:
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



[*] 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  <>

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