Re: iset-search implementations Wolfgang Corcoran-Mathe 19 Jan 2021 18:54 UTC

On 2021-01-18 10:13 +0100, Marc Nieper-Wißkirchen wrote:
> Whether something is called in tail position can be detected through the
> SRFI 157 continuation marks. The idea is that if I use
> `with-immediate-continuation-mark` around a call of `*-search` that the
> `success` and `failure` continuations must see it when they are called.
>
> This is what is meant by tail-calling `success` or `failure` in SRFI 146.
> (It would have been clearer, and may call for a PFN, had I added "with
> respect to the original call to `mapping-search`.)

I'm reading through SRFI 157 now.  Is John interested in using this
stronger definition of tail position for iset-search ?

More generally, what is the reasoning behind requiring a tail-call of
success or failure here?  I may be missing something obvious, but I
can't see that it's important for performance or semantics to mandate
this, and it may well result in worse performance for some structures.
I don't, at the moment, have an algorithm for constructing a
Patricia trie tail-recursively in better than O(n) time.  (Compare the
recursive iset-search, which, in the worst case, runs in
O(min(n, fx-width)) time, but usually attains log n.)

(I absolutely see the point of requiring a tail-call (by the caller)
of the insert, ignore, etc.)

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

"[F]ree flow of information is the only safeguard against tyranny.
... Beware of he who would deny you access to information, for in his
heart he dreams himself your master." --Commissioner Pravin Lal