multivar for loop variables

Bill Allombert <[email protected]> Wed, 29 Apr 2026 20:31:14 +0200
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <afJOclj33BI8w_eW@seventeen>
Dear PARI developers,

I have commited an experimental change (39f42a6ce5)
That allow to use multivar for loop variables as well:

for example, instead of writing 

foreach(factor(5!)~,pe,my([p,e]=pe);print(p,"^",e))

one can now write

foreach(factor(120)~,[p,e],print(p,"^",e))

Or instead of

forvec(ab=[3,3],my([a,b]=ab);print([a,b]))

forvec([a,b]=[3,3],print([a,b]))

or even

parforprime(p=2,1000,my(N=2^p-1);[N,ispseudoprime(N)],[N,t],if(t,print(p,":",N)))

The drawback is that this is not supported by GP2C and this might be difficult to
implement correctly in all case, given the various way iterators are implemented
in GP2C.

Cheers,
Bill