Re: Bizarre semantic of vecsearch/setsearch
Bill Allombert <[email protected]> Tue, 16 Jan 2024 15:18:24 +0100
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <ZaaQMLa4G9vg5B0e@seventeen> |
On Mon, Jan 15, 2024 at 08:22:07PM -0800, Ilya Zakharevich wrote:
> First, setsearch()/vecsearch() are just three flavors of the same function
> (since setsearch() has 2 flavors ;―]). — But the documentation of neither
> of them mentions the other one.
This is an historical mistake.
setsearch should have be defined as returning
setsearch(S,x,0)-setsearch(S,x,1) (with current notation).
instead of having a flag.
We fixed the C interface but not the GP interface:
16- gen_search / vecvecsmall_search: remove flag
the result is now positive if the element is found else -i if element
should be inserted at position i.
Cheers,
Bill.