Karim Belabas on Thu, 23 Jul 2026 16:00:17 +0200


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

Re: vecsort of vector with Vecsmalls


* Ruud H.G. van Tol [2026-07-23 12:51]:
> ? vecsort([ Vec([random(),random()]) |i<-[1..10]], 2)
> %1588 = [[99032517, 100995862], [1746833360, 734687613], [851393816,
> 746624236], [714819514, 805105716], [863304642, 885527659], [944699962,
> 1195915095], [1514894721, 1510424454], [1705234008, 1924836514],
> [1946743300, 2009371954], [923970141, 2087030666]]
> 
> ? vecsort([ Vecsmall([random(),random()]) |i<-[1..10]], 2)
>   ***   at top-level: vecsort([Vecsmall([random(),random()])|i<-[1..
>   ***  ^----------------------------------------------
>   *** vecsort: incorrect type in lexicographic vecsort (t_VECSMALL).
> 
> I hit this, so had to work around it with a
> (p,q)->cmp(p[2],q[2])
> 
> but maybe this can be made supported?

It's now supported in the 'master' branch.

Cheers,

    K.B.
-- 
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/