New gp features

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <20200212191430.rfc4cwgfjcolmu2r@yellowpig>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.