Ruud H.G. van Tol on Thu, 23 Jul 2026 12:51:37 +0200


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

vecsort of vector with Vecsmalls



? 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?

-- Ruud