Bill Allombert on Sat, 21 Feb 2004 00:05:52 +0100

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

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.