New draft (#4) of SRFI 189: Maybe and Either: optional container types Arthur A. Gleckler 02 Jun 2020 18:42 UTC
Re: New draft (#4) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 02 Jun 2020 18:48 UTC
Re: New draft (#4) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 02 Jun 2020 19:08 UTC
Re: New draft (#4) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 02 Jun 2020 19:06 UTC
Re: New draft (#4) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 02 Jun 2020 19:12 UTC
New draft (#5) of SRFI 189: Maybe and Either: optional container types Arthur A. Gleckler 02 Jun 2020 22:24 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 04 Jun 2020 10:26 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 04 Jun 2020 22:50 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 06 Jun 2020 16:58 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 07 Jun 2020 04:29 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 07 Jun 2020 10:28 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 14 Jun 2020 00:06 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 11:07 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 14 Jun 2020 15:58 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 16:08 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 14 Jun 2020 18:52 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 19:25 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 14 Jun 2020 20:30 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 20:57 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 14 Jun 2020 23:57 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 15 Jun 2020 06:22 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 15 Jun 2020 08:24 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types John Cowan 16 Jun 2020 18:47 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 16 Jun 2020 19:15 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 16 Jun 2020 19:17 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 17 Jun 2020 17:17 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 14 Jun 2020 19:25 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 19:43 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 14 Jun 2020 20:28 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 14 Jun 2020 20:42 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Wolfgang Corcoran-Mathe 15 Jun 2020 13:13 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 16 Jun 2020 07:56 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Lassi Kortela 05 Jun 2020 16:12 UTC
Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 06 Jun 2020 16:59 UTC

Re: New draft (#5) of SRFI 189: Maybe and Either: optional container types Marc Nieper-Wißkirchen 07 Jun 2020 10:28 UTC

Am So., 7. Juni 2020 um 06:29 Uhr schrieb Wolfgang Corcoran-Mathe
<xxxxxx@sigwinch.xyz>:

> > If you have code that consumes a Maybe, you can use `maybe-if' to turn
> > different data paths (encoded by Maybe) into different code paths. But
> > when you also need to know the payload, you would use `maybe-case':
> >
> > (maybe-case maybe
> >   ((just x)
> >    ;; maybe is a just and `x' is bound to the payload, which must be a
> > single object in this case
> >    ...)
> >   ((nothing)
> >    ;; maybe is a nothing
> >    ...))
>
> My first thought on seeing this form was that it's a special-purpose
> pattern-matcher.  With some standardized general pattern-matching form,
> it would of course be nice to be able to write something identical,

At the moment, we don't have such a general pattern matcher and it
will hardly be as efficient as this specialized one. And if we want to
see Maybes used in many algorithms, efficiency matters.

> s/maybe-case/match/ (or whatever).  But maybe-case by itself doesn't
> seem to add much; the following is equivalent to the above example,
> and only one character longer:
>
>     (maybe-ref
>      maybe
>      ;; maybe is a nothing
>      (lambda () ...)
>      ;; maybe is a just and `x' is bound to the payload, which must
>      ;; be a single object in this case
>      (lambda (x) ...))

That's true that it is just one character longer; but the maybe-case
form expresses a different intent. Moreover, it is less ugly!

In any case, the cost of adding a `maybe-case' macro is zero.

> The lambdas are a bit ugly, though.  I do think there's a need for a
> syntactically higher-level (i.e. than maybe-ref) form for working with
> Maybes.  Perhaps that's maybe-let*.

Maybe-let* (which should be the analogue of and-let*) will certainly
be helpful, but I don't see how it can replace my `maybe-case':

Marc