Welcome!
It's a nice iterator. n-dimensional (cartesian) iteration has been mulled over
for some time, with no permanent consensus emerging.
In the meantime, you may also be interested in the Cartesian package. In my
tests Cartesian is a bit faster than yours, but perhaps that will spur you on!
https://github.com/timholy/Cartesian.jl
Best,
--Tim
On Wednesday, June 05, 2013 01:19:19 PM James Porter wrote:
> All—
>
> I'm a student at Hacker School this summer; I wrote a little iterator
> type<
https://github.com/porterjamesj/learn-julia/blob/master/ndenumerate.jl
> >for n-dimensional enumeration of arrays, like in
> numpy<
http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndenumerate
> .html>. Its conceptually not much different than using enumerate() and then
> calling ind2sub() on the index, but is a nice syntactic sugar to have
> (imho) and in my tests it is about 2x faster than enumerate (I think since
> it is restricted to arrays as opposed to all iterables). Is there interest
> in adding this to the language? If so, where should it go?
> base/iterators.jl? base/array/jl?
>
> Best
> James Porter