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
>
> On 06/06/2014 08:27 AM, andrew cooke wrote:
> >
> > |
> > julia>l
> > 1x3Array{Int64,2}:
> > 123
> >
> > julia>s =start(l)
> > 1
> >
> > julia>i,s =next(l,s)
> > (1,2)
> >
> > julia>i,s =next(l,s)
> > (2,3)
> >
> > julia>done(l,s)
> > false
> >
> > julia>i,s =next(l,s)
> > (3,4)
> >
> > julia>done(l,s)
> > true
> > |
> >
> >
> >
> > On Thursday, 5 June 2014 19:56:13 UTC-4, K leo wrote:
> >
> > Anyone can give an example, or point to an online site please?
> >
>
>