Hi all,

I am right that the foreach-loop variant only supports lists but not string arrays or matrices? At least the following does not work using latest git-version.

<hansl>

strings S = defarray("A", "B", "C")
loop foreach i S -q
    eval S[i]
endloop

matrix M = seq(1,3)
loop foreach i M -q
    eval M[i]
endloop

</hansl>


I would find this quite handy, as nelem() or rows()/cols() may be avoided.

While it's clear what to do for a vector (simply iterate over the column-/row-dimension), one may say that iteration for a matrix may work over rows thus returning all columns for each row.


Best,

Artur
_______________________________________________
Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it
To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/

Reply via email to