variable vector assignments in loop

Max Alekseyev <[email protected]> Sun, 12 Oct 2025 12:57:38 -0400
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <CAJkPp5MpZApY1D8Z1Ff4K0zstU2LcQhLrF82JvaHfia+7Aj8xQ@mail.gmail.com>
Hello,

PARI/GP well supports assignments like
[a,b] = [1,2];

However, this does not work in loops like

? foreach(factor(100)~, [p,k], print([p,k]) )
  ***   variable name expected: foreach(factor(100)~,[p,k],print([p,k]))
  ***                                                ^-------------------

Currently we can only get vectors as whole, but not unpack them:

? foreach(Vec(factor(100)~), pk, print(pk) )
[2, 2]~
[5, 2]~

PS. This particular example would allow us to easily parse primes and their
powers from the factorization.

Regards,
Max