default(realprecision,38);
v = [[1,2], [4,1], [3,4], [1,3/2], [5/2,1.]]; a = [1,2]; b = [5,2];
w = vecsort(v)
vecsearch(w, a)
vecsearch(w, b)

K = [ 1, 2, 3, [2,1], [3,1], (x,y)->x[1] - y[1] ];
{
  for (i = 1, #K,
    iferr (w = vecsort(v, K[i]);
           print(w);
           print(vecsearch(w, a, K[i]));
           print(vecsearch(w, b, K[i])),
           E, print(E))
  )
}
v = [x^2+1, x^3-2, x+1, x^2+27];
f(x)=poldisc(x);
vecsort(v, f)
vecsort(v, f, 1)
vecsort(v, f, 1+4)
vecsort(v, f, 1+4+8)
vecsearch(v, x+10, f)

T=vecsort(Vecsmall([4,3,2,1]))
vecsearch(T,-1)
vecsearch(T,5)
vecsearch(T,3)
vecsort(List([4,3,2,1]))
v=[4,3,4,1,4,2,3];
vecsort(v,, 8)
vecsort(v,, 8+1)
vecsort(v,, 8+4)
vecsort(v,, 8+4+1)
vecsort(List(),,4)

\\Errors
vecsearch(Vecsmall(1),1,1)
vecsort(Vecsmall(1),1)
