| McLaughlin, James on Sat, 21 Feb 2004 16:31:00 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| RE: peculiar parenthesis problem. |
Thanks. It seems I misunderstood the function of the braces { }.
I had thought these were used to enclose long programs but I see I was wrong.
'Best,
Jimmy.
-----Original Message-----
From: Bill Allombert [mailto:allomber@math.u-bordeaux.fr]
Sent: Fri 2/20/2004 5:59 PM
To: pari-users@list.cr.yp.to
Cc:
Subject: Re: peculiar parenthesis problem.
On Fri, Feb 20, 2004 at 05:36:09PM -0500, McLaughlin, James wrote:
>
> I have a question concerning the use of { and }.
>
> If I move the ${$ to the start of the code, which seems the logical
> place to put it(see the second piece of code below), I get no output.
>
> I suspect the problem lies with the way I defined d(n) and subsequently
> g(n) and h(n). I want something that lets me evaluate these functions at
> different values of n. As it is, just doing g(33) etc works. The only
> problem is with the { and }.
You have a hit a subtle point of GP grammar, and it took me a while
to make gp2c accomodate it. According to GP grammar, a function is
terminated by a (unquoted) end-of-line.
What happen with your programm is that all end-of-line are quoted, so
the function d(n) 'eat' all the text until the end of the files.
> Can anyone tell me how to fix this?
Never write more than one function inside a {} block.
Cheers,
Bill.