Re: New gp features
Bill Allombert <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <ZN4LtxYL+kS0X1Pz@seventeen> |
On Sun, Aug 13, 2023 at 08:39:18PM +0200, [email protected] wrote: > Few questions: > > A) foreach cannot be redefined? > > foreach2(a,b,c) = foreach(a,b,c); This does not work, because user GP functions are 'strict': b and c are evaluated before foreach2 is evaluated to a closure. Instead you can do foreach2(a,c) = foreach(a,b,c(b)) and then foreach2(a,t->printf("%d ",t[1])) > B) foreach variable cannot be multi assignment tuple? > > ? foreach(rsa,[l,n],printf("%d ",l)); > *** variable name expected: foreach(rsa,[l,n],printf("%d ",l)); > *** ^----------------------- No, this is not supported. > C) holes only allowed on LHS, not on RHS? > > ? [a,b,c] = [1,2] > *** at top-level: [a,b,c]=[1,2] > *** ^-------- > *** nonexistent component: index > 2 c would not be defined. Cheers, Bill