Re: iset-search implementations
Wolfgang Corcoran-Mathe 11 Dec 2020 02:47 UTC
On 2020-12-10 21:23 -0500, John Cowan wrote:
> It can indeed insert any element, but "at the point at which ..." is not in
> the spec, or in SRFI 113 either; the requirement is that the old element is
> not in the returned set and the new element is. We have two choices:
> change the specs or fix the implementations. As a general rule, in SRFI
> work we prefer fixing the implementations, and I'm very reluctant to alter
> existing specs just because some implementations would be somewhat shorter
> and a hair faster than if they couldn't handle the update continuations in
> full generality.
That's fine. If `search' is set by convention, then this is, indeed,
an implementation issue. I may have to fall back to the two-pass
search-then-adjoin approach, since I doubt there's a better way.
In general, I think that the lack of a constraint on the value
inserted by update probably means two traversals, for almost *any*
implementation of a set or similar structure. While the form of the
`search' procedure may be semi-standard at this point, this handicaps
it as a general interface to traversal.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"I don't really know much about Python. I only stole its object
system for Perl 5. I have since repented." --Larry Wall