Bill Allombert on Tue, 06 Feb 2024 16:47:47 +0100


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

Re: vec* functions on lists


On Mon, Jan 08, 2024 at 06:04:27AM -0500, Max Alekseyev wrote:
> In PARI/GP version 2.16.1 I see
> 
> ? vecmin(List([1,2,3]))
> %1 = List([1, 2, 3])
> 
> ? vecprod(List([1,2,3]))
>   ***   at top-level: vecprod(List([1,2,3]))
>   ***                 ^----------------------
>   *** vecprod: incorrect type in vecprod (t_LIST).
>   ***   Break loop: type 'break' to go back to GP prompt
> 
> Can vector functions be extended to support List arguments (as if they were
> vectors)?

As a rule, I convert lists to vectors as soon as I have finished to fill them.
I always do
fun(...) = my(L=List());....;Vec(L); 

Cheers,
Bill