That's great - Thanks for making the double string substitution work!
Best
Leon
Am 16.02.2013 15:44, schrieb Allin Cottrell:
On Fri, 15 Feb 2013, Pindar wrote:
> in terms of the bundle problem I was not concrete enough.
> I'm using the current snapshot and still get a crash with:
>
> <hansl>
> bundle b = null
> b["foo"] = 1
> # open bundle via gui in symbol window
> bundle b = null
> # close bundle via gui -> crash
> <hansl>
OK, now I see what you mean. Fixed in CVS.
> I have another question concerning loops: I want to use the @ functionality
> for changing the looped through lists.
> This is not working as expected. I need it for e.g. trivariate interaction:
>
> <hansl>
> open chard.gdt
>
> loop for i=2..4 -q
> string listName = "inter$i"
> list @listName = null
> endloop
>
> inter2 = 1
> inter3 = 3 4
> inter4 = 5
>
> loop for i=2..4 -q
> string listName = "inter$i"
> loop foreach j @listName -q
> print j
> print "$j"
> eval varname(@listName)
> endloop
> endloop
> <hansl>
This is a rather tricksy use of double string substitution:
when the inner loop is set up is hard for gretl to know what
"@listName" is, or will be. However, if we guess it ought to
evaluate to a string that gives the name of a list, then
things will go as you intend in this case. The following now
works in CVS:
<hansl>
open data4-10.gdt
list L1 = 1
list L2 = 3 4
list L3 = 5
loop i=1..3 -q
string listName = "L$i"
printf "i = %d: listName = '%s'\n", i, listName
loop foreach j @listName -q
printf " j = %d and dollar-j = '$j'\n", j
endloop
endloop
</hansl>
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users