Errata for range-any Wolfgang Corcoran-Mathe (07 Oct 2022 17:29 UTC)
Re: Errata for range-any John Cowan (07 Oct 2022 21:00 UTC)
Re: Errata for range-any Wolfgang Corcoran-Mathe (07 Oct 2022 21:56 UTC)
Re: Errata for range-any John Cowan (07 Oct 2022 22:10 UTC)
Re: Errata for range-any Wolfgang Corcoran-Mathe (08 Oct 2022 00:56 UTC)
Re: Errata for range-any Arthur A. Gleckler (08 Oct 2022 04:38 UTC)
Re: Errata for range-any Wolfgang Corcoran-Mathe (08 Oct 2022 15:22 UTC)

Re: Errata for range-any Wolfgang Corcoran-Mathe 07 Oct 2022 21:56 UTC

On 2022-10-07 17:00 -0400, John Cowan wrote:
> On Fri, Oct 7, 2022 at 1:29 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> wrote:
>
> > As specified, range-any “returns the last [true] value returned by
> > 'pred'”.  This is different SRFI 1 'any' and similar forms, which
> > return the *first* truthy value.
>
> It comes to the same thing, because any-ish procedures do not invoke the
> predicate again after it returns true.  So "the last value returned by
> pred" is not the result of pred on the last value, which I think is how you
> are reading it; rather, it is exactly the same as "the first true value
> returned by pred".

I see what you mean, but I think this should be made clearer.
Here's SRFI 196 on range-any:

> Applies pred element-wise to the elements of the ranges and returns
> true if pred returns true on any application. Specifically it
> returns the last value returned by pred. Otherwise, #f is returned.

You could read this to mean that range-any has to run through all
the true results and return the last.  At least one wise guy has
already done this.  (I apparently forgot how 'any' works while
writing the range-any sample implementation.  That, at least,
will have to be fixed.)

Compare this spec to those from othe SRFIs.  In 134, ideque-any “invokes
pred on the elements of the ideque in order until one call returns a
true/false value, which is then returned”.  Similarly, SRFI 1 says
that “the iteration stops when a true value is produced”.

range-any follows the same pattern, and SRFI 196 should be less
subtle on this point.

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