| Karim Belabas on Wed, 31 May 2006 17:20:24 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: What happened to 'local'? |
* Ottavio G. Rizzo [2006-05-31 17:00]:
> Hallo,
>
> I just installed 2.3.0, and I realized that the gp function 'local'
> disappeared.
It's not a 'function', it's a 'scope declaration', whose purpose is to tell
something to the GP parser. In particular, there is no online help for it.
> I checked the source code, to make sure it's not a problem with the
> fedora package, but I could not find it.
>
> I searched the mailing lists, but I couldn't find any mention of the
> function, which is still mentioned in the manual.
>
> It appears to me that 'local' is still needed:
>
> ? a=1
> %23 = 1
> ? test(x)={a=x+1;return(a)}
> ? test(12)
> %24 = 13
> ? a
> %25 = 13
>
> Was I looking in the wrong place, there's something I don't understand,
> or the function was just left out?
What makes you think it has disappeared ?
(17:14) gp > test(x)={local(a);a=x+1;return(a)}
(17:14) gp > test(12)
%1 = 13
(17:14) gp > a
%2 = a
Btw the braces are not necessary for 1-liners:
test(x) = local(a);a=x+1;return(a)
would work just as well.
Cheers,
K.B.
--
Karim Belabas Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP]