Ruud H.G. van Tol on Tue, 15 Sep 2026 16:30:41 +0200


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

Re: vecmax issue


On 2026-09-15 12:54, Bill Allombert wrote:
On Tue, Sep 15, 2026 at 12:37:06PM +0200, Ruud H.G. van Tol wrote:

? version()
%1 = [2, 17, 4]

? vecmax([[0], [1]])
   ***   at top-level: vecmax([[0],[1]])
   ***                 ^-----------------
   *** vecmax: forbidden comparison t_VEC (1 elts) , t_VEC (1 elts).
   ***   Break loop: type 'break' to go back to GP prompt
break>

Is that as expected?

Yes.

? vecsort([[0], [1]],,4)[1]
%2 = [1]

??vecmax
  'largest refers to the ordinary real ordering ( <= )'

??vecsort
  'If  cmpf  is  omitted,   we  use  the standard comparison function lex'

This is not the same ordering.
OK, so how about adding a {cmpf} parameter to vecmax?

-- Ruud

P.S. I might have asked this before.
It just feels weird to me that vecmax and vecsort don't compare the same way by default.