I'm trying to construct an array while making an array of pairs of floats. 
The error below is extremely confusing and I have no idea why.


=================================================
# create the array w/o type declarations works fine
julia> x = [(0.0, 1.0), (0.0, 1.0)]
2-element Array{(Float64,Float64),1}:
 (0.0,1.0)
 (0.0,1.0)

# but declaring the type in the constructor breaks it?!
julia> y = (Float64, Float64)[(0.0, 1.0), (0.0, 1.0)]
ERROR: `getindex` has no method matching 
getindex(::Type{(Float64,Float64)}, ::(Float64,Float64), 
::(Float64,Float64))

# but somehow manually adding with push! works?!
julia> z = (Float64, Float64)[]
0-element Array{(Float64,Float64),1}

julia> push!(z, (0.0, 1.0))
1-element Array{(Float64,Float64),1}:
 (0.0,1.0)

julia> push!(z, (0.0, 1.0))
2-element Array{(Float64,Float64),1}:
 (0.0,1.0)
 (0.0,1.0)

Reply via email to