Bill Allombert on Tue, 16 Jan 2024 15:18:31 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Bizarre semantic of vecsearch/setsearch


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.