Bill Allombert on Fri, 12 Nov 1999 14:29:59 +0100 (MET)


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

Re: Turning a sequence of expr into expr


A solution is to write
ploth(t=100,110,if(1,z=zeta(0.5+I*t);[real(z),imag(z)]))

>I got an impression that functions which take a chunk of code as an
>argument always take a statement, though the parser gives them a
>sequence of statements.

It is perfectly true, it's the difference between a 'seq' and an 'expr'
an 'expr' cannot contains ';' 

? ?ploth
ploth(X=a,b,expr,{flags=0},{n=0}):
            ^^^^
? ?for
for(X=a,b,seq):
          ^^^

Only true control statements handle seq ,if,forxxx, while,until
but not sumxxx,prodx,solve,intnum etc..

vector(v) and matrix have been corrected to handle seq but 
the doc has not been updated.

In the C code you must use lisseq to read a "seq"
(See PARI/GP Manual 4.7.1 page 167)

One solution would be to implement a control statement "sequ" similar
to the ',' operator in C, so we could write

ploth(t=100,110,sequ(z=zeta(0.5+I*t);[real(z),imag(z)]))

Bill.