Am 01.10.21 um 18:56 schrieb Sven Schreiber:
Hi, some random-but-inspired-by-real-work thoughts about gretl's
lists:
-- The fact that you can use index ranges with lists doesn't seem to be
documented, or is it? For example, a little bit to my amazement, this
works:
<hansl>
open denmark
list L = LRM LRY IBO
ols L[1] const L[2 : nelem(L)]
</hansl>
(And in the future I guess even with "end" in place of "nelem(L)".)
Hah, that's cool. Wasn't aware of that, too.
Maybe it should be mentioned in the list chapter.
-- What isn't possible yet is to operate on all list elements at once,
without using an explicit loop. What I mean is, wouldn't it be nice if
one could do something like:
list L2 = L .- x # not possible
to do the equivalent of the following loop code:
<hansl>
list L2 = null
loop foreach i L
L2 += $i - x
endloop
</hansl>
Mmmhh, that looks (somehow) natural to me at a first glance. From a
perspective that a list of series is "just" a matrix with some index, I
don't see why that should not be possible.
Artur