On Thu, 16 Sep 2021, Sven Schreiber wrote:
Am 16.09.2021 um 19:38 schrieb Riccardo (Jack) Lucchetti:
>
> Hi all,
>
> being the king of the typo has its advantages: for example, you find
> weird bugs:
>
> <hansl>
> nulldata 60
> setobs 4 1:1
> y = normal()
> ols y 0 y(0 -to -1) # note the typo
> ols y 0 y(1)
> </hansl>
>
> The two models are identical.
Weird indeed...
Now, I don't want to hijack the thread, and so I changed the subject
line a little bit, but this special keyword "to" reminded me that in
different places in gretl/hansl there are different idioms or syntax
constructs for indicating a range:
(1) loop i = 1..N
(2) ols y const y(-1 to -3)
(3) seq(1, N)
OK, I admit that the last one is perhaps a little bit apart from the
others, but couldn't there be some harmonization?
Like "loop i = 1 to N", which is very nice to read, or the other way
around "ols y 0 y(-1 .. -3). I also wouldn't mind if {1..N} meant the
same thing as seq(1,N).
I know I know, all pure syntactic sugar and not strictly necessary, but
again: some harmonization might be nice.
FWIW, the "to" in a range of lags is a RATS-ism from way back. I'm
not too keen on propagating it to other contexts.
There's yet another range symbol: ':' in matrix indexing, M[1:n,].
The thought has crossed my mind to change the standard loop range
spec to
loop i=1:N # as in R
but I think it's too late. We'd surely have to support the original
syntax as well, so it would add complications.
Allin