| hermann on Wed, 29 Apr 2026 21:52:42 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: multivar for loop variables |
On 2026-04-29 20:31, Bill Allombert wrote:
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
thank you, I really like that.I built the current git, and it directly works as advertized with my RSA_numbers_factored pari library I created 3 years ago:
hermann@8840hs:~/pari$ ./gp -q ~/RSA_numbers_factored/pari/RSA_numbers_factored.gp
? foreach(RSA.factored(mod4=[1,1]),[l,n,p,q],print1(l" ")) 59 129 180 230 768 ? foreach(RSA.factored(mod4=3),[,n],print1(#digits(n)" ")) 79 100 110 120 140 150 170 174 200 210 212 232 240 ?".factored(...)" returns 4-tuples, and your new feature seems to deal correctly when less than 4 of the components are requested.
I see that it may be a problem, but since I seldom use GP2C I could live with that.The drawback is that this is not supported by GP2C and this might be difficult toimplement correctly in all case, given the various way iterators are implementedin GP2C.
In case I would use the new feature and the need arises to use GP2C, I would just create copy with the workaround you mentioned and compile that.
Regards, Hermann.