Hello again,
I think the introduction of the array type kind of begs for an extension
of the "foreach" loop variant.
Something like this:
<hansl>
matrices Ms = array(3)
loop foreach i Ms
$i = I(2)
endloop
</hansl>
I'm aware that the same thing could be achieved with
<hansl>
matrices Ms = array(3)
loop i=1..nelem(Ms)
Ms[i] = I(2)
endloop
</hansl>
so this is syntactic sugar and I admit that I'm influenced by Python's
"iterables" concept or whatever it's called.
One longer-term argument in favor of more "foreach" usage could be that
such a loop is almost by definition "parallelizeable"; it could be taken
to mean that the individual loop iterations are independent from each
other. I think something similar is happening with R's foreach package.
thanks,
sven
Show replies by date