Re: New gp features

[email protected]
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <[email protected]>
Thanks on 2 and 3.

On 2023-08-17 13:59, Bill Allombert wrote:
> 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]))
> 
which GP version is needed to make that work?

hermann@7600x:~$ gp --version
                   GP/PARI CALCULATOR Version 2.15.3 (released)
           amd64 running linux (x86-64/GMP-6.2.1 kernel) 64-bit version
    compiled: Jun 30 2023, gcc version 11.3.0 (Ubuntu 
11.3.0-1ubuntu1~22.04.1)
                             threading engine: single
                (readline not compiled in, extended help enabled)
hermann@7600x:~$ gp -q
? foreach2(a,c) = foreach(a,b,c(b))
(a,c)->foreach(a,b,c(b))
? foreach2(a,t->printf("%d ",t[1]))
   ***   at top-level: foreach2(a,t->printf("%d ",t[1]))
   ***                 ^---------------------------------
   ***   in function foreach2: foreach(a,b,c(b))
   ***                         ^-----------------
   *** foreach: incorrect type in foreach (t_POL).
   ***   Break loop: type 'break' to go back to GP prompt
break>


Regards,

Hermann.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.