Re: Failure continuations for fxmapping-update and friends
Wolfgang Corcoran-Mathe 21 Jun 2021 20:31 UTC
On 2021-06-21 22:12 +0200, Marc Nieper-Wißkirchen wrote:
> Am Mo., 21. Juni 2021 um 21:35 Uhr schrieb Wolfgang Corcoran-Mathe <
> xxxxxx@sigwinch.xyz>:
> >
> > Is there a use-case for a success continuation that you think is
> > compelling? It seems somewhat extraneous in both contexts. The
> >
>
> [snip]
>
> Without the SUCCESS argument, you would have to code something ugly like:
>
> (call/cc
> (lambda (c)
> (let-values (((k v)
> (fxmapping-find (lambda (k v) (positive? v))
> fxmap
> (lambda () (c #f)))))
> (list k v))))
Yes, I agree that it's (unfortunately) pretty clumsy to work with
multiple returns, and that we can clean this up with a success
procedure. So I'm thinking that fxmapping-find should have this.
It's less clear why (single-valued) fxmapping-ref should have a
'success' argument, but I'll leave it alone at this point.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"Simplicity does not precede complexity, but follows it."
--Alan J. Perlis