Thanks again for the help.
Yes, I do know the number of dimensions before the iterations start, but
it is high, as high as 50, and is different under different situations.
So I try to simplify code for that.
The cartesian package is interesting and I will study it. Besides that,
is there any other ways to achieve it?
On 06/06/2014 11:07 AM, andrew cooke wrote:
do you mean you need to iterate in multiple dimensions, but you don't
know beforehand how many dimensions? i'm pretty sure the cartesian
package would help in that case.
http://julia.readthedocs.org/en/latest/devdocs/cartesian/
On Thursday, 5 June 2014 21:56:37 UTC-4, K leo wrote:
Thanks very much for the guide.
I need to iterate in multiple dimensions. The example below is for 2
dimensions. Could anyone help making it simpler - in ways of
recursions
perhaps?
l = [1:3]
state = zeros(Int, 2)
II = zeros(Int, 2)
state[1] = start(l)
while !done(l, state[1])
II[1], state[1] = next(l, state[1])
state[2] = start(l)
while !done(l, state[2])
II[2], state[2] = next(l, state[2])
println(II)
end
end