El domingo, 31 de julio de 2016, 20:16:04 (UTC-4), Sheehan Olver escribió: > > I'm doing the following: > > > immutable FooIterator{d} end > > Base.start(::FooIterator{d}) = tuple(zeros(Int,d)...)::NTuple{d,Int} >
You can use the `ntuple` function, which constructs a tuple from a function: julia> ntuple( x -> 0, 3) (0,0,0) julia> typeof(ans) Tuple{Int64,Int64,Int64} > > > But is there a more elegant way of getting the type inferred? I suppose I > can override low order d directly: > > Base.start(::FooIterator{2}) = (0,0) > Base.start(::FooIterator{3}) = (0,0,0) >