Bill Allombert on Wed, 12 Feb 2020 20:14:33 +0100


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

New gp features


Dear PARI developers,

We added two GP language features:

1) A new command foreach:
foreach(V,X,seq):

   Evaluates seq,  where the formal variable X ranges through the
components of V (t_VEC, t_COL,
t_LIST or t_MAT).  A matrix argument is interpreted as a vector
containing column vectors, as in
Vec(V).

? foreach([1,2,3],v,print(v))
1
2
3

2) holes in multi assignement:
? [a,,c]=[1,2,3]
%2 = [1,2,3]
? a
%3 = 1
? c
%4 = 3
Idem within a my() or local():
? my([a,,c]=[1,2,3]);[a,c]
%8 = [1,3]

Cheers,
Bill