Re: The search API Wolfgang Corcoran-Mathe (14 Sep 2021 16:08 UTC)
Re: The search API Marc Nieper-Wißkirchen (14 Sep 2021 16:22 UTC)

Re: The search API Wolfgang Corcoran-Mathe 14 Sep 2021 16:08 UTC

On 2021-09-10 19:31 -0700, Arthur A. Gleckler wrote:
> On Thu, Sep 9, 2021 at 8:14 AM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> wrote:
>
> > Yes, 'ignore' is vestigial; thanks for pointing this out.  Perhaps
> > removing it could be errata-ed into SRFI 224.
> >
>
> If you'd like to make that change, would you please send me a patch or a
> pull request, and perhaps for the change John recommended below?:

With a little time to think about it, I'm not sure about removing the
'ignore' continuation from the -alter function.  I think it provides
a minor convenience, namely, it gives the caller a convenient way to
return the original dictionary if it's not otherwise bound.
e.g. using fxmapping-alter, for some fxm and function f:

    (fxmapping-search
     (f fxm)
     ...
     (lambda (insert ignore) (ignore)))

Without ignore, we'd have to write this in "A-normal form" so that
the modified dictionary can be returned:

    (let ((fxm* (f fxm)))
      (fxmapping-search
       fxm*
       ...
       (lambda (insert) fxm*)))

(Of course, the same argument applies to the "found" case, where you'd
use the 'replace' continuation to get a copy of the original
dictionary; there's no ignore option.)

I also think that the symmetry with the existing -search forms is
preferable, at least until/unless SRFI 225 specifies a new interface.
In any case, I don't think this is currently important enough to
warrant adding errata to SRFI 224.

Thoughts?

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

"It is a syntax error to write FORTRAN while not wearing
a blue tie." --James Iry