Cool! Sent from my iPhone
> On 1 Aug 2016, at 17:23, Simon Danisch <[email protected]> wrote: > > How about: > julia> @code_warntype ntuple( x -> 0, Val{3}) > Variables: > #self#::Base.#ntuple > f::##1#2 > #unused#::Type{Val{3}} > > Body: > begin > $(Expr(:static_parameter, 2)) # line 73: > # meta: location tuple.jl _ntuple 80 > # meta: location tuple.jl _ntuple 80 > SSAValue(1) = $(QuoteNode(0)) > # meta: pop location > # meta: pop location > return > (Core.tuple)(SSAValue(1),$(QuoteNode(0)),$(QuoteNode(0)))::Tuple{Int64,Int64,Int64} > end::Tuple{Int64,Int64,Int64} > > Am Montag, 1. August 2016 02:16:04 UTC+2 schrieb Sheehan Olver: >> >> I'm doing the following: >> >> >> immutable FooIterator{d} end >> >> Base.start(::FooIterator{d}) = tuple(zeros(Int,d)...)::NTuple{d,Int} >> >> >> 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)
