Karim Belabas on Fri, 10 Apr 2009 13:09:16 +0200

 Re: v 2.4.2 echos \r file

```* cino hilliard [2009-04-09 21:54]:
> I installed the windows sell-extractor v 2.4.2
[...]
> When I read script in with the \r, I get some kind of a -> code with the script.
>
> (14:05:01) gp > \r rg
> %2 = (x)->local(n=1,L,s=1,r);L=r=log(x);while(s<10^30*r,s=s+r/(zeta(n+1)*n);n=n+
> 1;r=r*L/n);(s)

PARI functions are treated as arbitrary objects now (of type t_CLOSURE); in
particular they can be printed, for wich we use this

(variables)->function text

notation. The latter is perhaps more familiar in the following context:

(12:47) gp > f = x->x^2    \\ identical to f(x) = x^2
%1 = (x)->x^2
(12:47) gp > f(3)
%2 = 9

As with ordinary objets, if you don't want to see them printed, end your
statement with a semi-colon.

(12:49) gp > f(x) = x
%6 = (x)->x
(12:50) gp > f(x) = x;
(12:50) gp >

Rationale: This is essentially backward compatible (it does prevent calling
user functions without parentheses, which used to be tolerated), and allows a
number of new useful constructs, like

(12:48) gp > apply(f, [1,2,3])
%3 = [1, 4, 9]

(12:48) gp > select(isprime, [1,2,3,4,5])
%4 = [2, 3, 5]

(12:49) gp > vecsort([-1,2,3], (x,y)->sign(y-x))
%5 = [3, 2, -1]

[ 2nd argument to vecsort can now be an arbitrary comparison function; the
above implements a reverse sort, in a neater and more flexible way than using
additional obscure flags (which are still available) ]

CAVEAT: not sure whether all of the above are available in this Windows
version. I'll try to release 2.4.3 before summer.

Cheers,

K.B.

> PS:
>
> Installing the latest cygwin (when I finally found a mirror that did not error out)
>
> stops the ~ (tilde) character when you hit the delete key and deletes the char
> at the cursor. This works for the last few versions and verifies the FAQ entry
> on this.

Good. I guess you're refering to

http://www.math.u-bordeaux.fr/~belabas/pari/doc/faq.html#windel

I just made the statement more affirmative. I'll try to find a Windows machine,
and install a recent Cygwin before releasing the next self-extractor.

--
Karim Belabas, IMB (UMR 5251)  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-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`

```