Am 22.10.2022 um 02:21 schrieb Federico Fiorani:
Dear all,
Gretl on my Windows crashes running this script
<hansl>
strings s = null
s += "text"
s -= "text"
</hansl>
Does anyone have the same problem?
Yes, I see this, too - thanks for the report.
This crash must be fixed, of course, but using the "-=" operator for an
array is not supported, AFAIK. In fact, I believe it is not possible to
selectively delete elements from an array after creation - to achieve
that, you would have to make a copy of the array where you skip the
unwanted elements. Other alternatives include: Simply drag along these
additional elements and ignore them (by using appropriate checks), or
perhaps in some cases use a gretl "bundle" datatype instead of an array.
Bundle elements can be deleted.
BTW, as a side remark, if you want to get the index positions where a
strings array contains a given string, you can use the instrings()
function, so in your example instrings(s, "text"). (But I admit that
getting the complementary positions where this condition is false is a
little more involved.)
cheers
sven