Karim BELABAS on Tue, 10 Sep 2002 15:42:47 +0200 (MEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: gnil


On Tue, 10 Sep 2002, Bill Allombert wrote:
> The magic gnil object is static in GP.

No. It is global in the library.

> This mean a C function is either 'void' and always return nothing (gnil) or
> not 'void' and never return nothing (gnil) but 0 instead.
>
> Consider now the GP script
> f(x)=if(x,1)
> We have
> ? f(1)
> %9 = 1
> ? f(0)
> ?
> This behaviour cannot be emulated by GP2C.

What's wrong with

GEN f(GEN x) { return gcmp0(x)? gnil: gun; }

?

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/