Karim BELABAS on Sat, 1 Jun 2002 18:50:55 +0200 (MEST)


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

Re: lex() feature


On Wed, 3 Apr 2002, Michael Somos wrote:
> There is a long-standing feature of lex() which is not documented.
>
> ? ord(x)=lex(x,"")
> ? print(ord("a")" "ord("b")" ... "ord("z"))
> 97 98 ... 122
>
> Is this something that will eventually go away? If not, it should be
> documented.

I consider this a bug, which depends on the specific implementation of
strcmp() in the C library [ on my Linux box, you get the expected answer
'1 1 ... 1' ]. The user's manual says -1, 0, 1 are the only valid answers
to a comparison function.

I've removed that feature.

> If it goes away, it would be nice to have an alternative.

ord(x) = extern("perl -e 'print ord(" x ")'")

    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/