Am 02.05.2024 um 11:51 schrieb Riccardo (Jack) Lucchetti:
On 02/05/2024 11:00, Rigoberto Perez Suarez wrote:
> ...
>
> This code does not work properly. It is necessary to include a new
> parenthesis in the quotient (l.$x/l.$x(-1)) (which would not be
> necessary) to perform the operation correctly.
Uhm, the syntax above works fine here, with respect to the number of
parentheses. However, it seems that we do have another problem: the
script below produces bogus results, which are evident if you run it
(the series "foo" and "ty1" should be identical).
...
This is due to the fact that the "listname.$x" idiom is _not_ valid
outside functions: it's a special provision to ensure that series
names coming from the outside level of execution don't clash with
locally-defined series.
I think this should be intercepted somehow, and possibly an error
should be flagged.
Well, I thought so, too. However, even inside a function there seems to
be a problem. Test case:
<hansl>
open denmark
list L = LRM LRY
function void checko(list L, series LRM)
list Lt = deflist()
loop foreach x L
series t$x = round(10000*(L.$x/L.$x(-1)-1))/100
Lt += t$x
endloop
# compare
series myt_LRM = round(10000*(LRM/LRM(-1)-1))/100
eval sum(abs(myt_LRM - Lt[1])) # should be zero
end function
checko(L, LRM)
</hansl>
At first sight this looks pretty bad, to be honest.
Thanks for the report.
cheers
sven