On Fri, 24 May 2013, Sven Schreiber wrote:
Am 24.05.2013 22:39, schrieb Allin Cottrell:
> yOn Fri, 24 May 2013, Sven Schreiber wrote:
>> I tried to wrap this long line:
>> c3 = sum(diag((((I(rows(P))-P)*Vpsi)**P)/(I(rows(P)^2)-P**P))) +
>> at the + sign like this:
>> c3 = sum(diag((((I(rows(P))-P)*Vpsi)**P)/(I(rows(P)^2)-P**P))) \
>> + sum(diag((P/(I(rows(P))+P))*Vpsi))
>> but gretl gave me a syntax error (within a function package), and I
>> don't really understand why. A bug?
> Possibly, but your use of of sum() is definitely invalid. This
> function requires a series or list argument, as per the
Actually I didn't write this line, but thanks for pointing this out --
then I guess the question is why is gretl NOT complaining without the
Hmm, it seems that despite the limitation to a series or list
argument in the doc, in fact the sum() function accepts a row
or column vector argument, in which case it returns the sum of
the elements of the vector. What do we think: document that,
or ban it, in favor of using sumc() or sumr() as appropriate?
But meanwhile, returning to the line-wrapping issue: when
functions are parsed and saved in a package, line-breaking via
the backslash character is eliminated -- we consolidate the
lines so they can be read in one go. There was a bug in the
method for doing this, but I believe that was fixed in CVS a
few weeks ago (on May 6, to be precise).
I tried creating a dummy package from a function containing
exactly the line you quoted above (with backslash break) and
it ran OK, no syntax error. So I suspect the bug report here
may be out of date.