Re: variable vector assignments in loop

Bill Allombert <[email protected]> Wed, 29 Apr 2026 21:23:44 +0200
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <afJawEDyuQec0S3_@seventeen>
On Sun, Oct 12, 2025 at 12:57:38PM -0400, Max Alekseyev wrote:
> 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:

I have finally implemented that feature in the master branch, see post to
pari-dev. Note that this is experimental.
This is unfortunately not supported by GP2C.

Cheers,
Bill