On Mon, 4 Dec 2017, Artur Tarassow wrote:
> What's the context in which "delete" is not working
on a matrix?
Ok, here I am again. The following does not work using 2-days old git on
ubuntu:
<hansl>
set verbose off
clear
# generate artificial data set
nulldata 10
matrix M = mnormal(10,2)
loop i=1..2 -q
series v$i=M[,i]
endloop
store "testdat1.csv" --csv --no-header
# Load in a case matrix
loop lcase=1..1 -q
sprintf f "testdat$lcase.csv"
open "@f" --quiet --preserve
list L = null
list L = v1..v2
list L = dataset - const
matrix case$lcase = {L}
eval case$lcase
delete case$lcase # error: "delete case1: not allowed"
endloop
delete case1 # works
Ah, then that's the generic ban against deleting objects inside a
loop: this is the price to be paid for certain optimizations of the
gretl loop code. If we're to "quasi-compile" loops we can't have
objects popping out of existence as the iterations proceed.
The nearest acceptable equivalent would be
case1 = {}
to reduce the matrix in question to an empty one (0 x 0), hence
freeing up almost all of the memory allocated to it.
Allin