When I try to create an Array with a list, this leads to Array{Any, 1} , even if I encode all the elements into a "character":
julia> u_col_names=[symbol("user_id"), symbol("age"), symbol("sex"), symbol("occupation"), symbol("zip_code")] 5-element Array{Symbol,1}: :user_id :age :sex :occupation :zip_code julia> col_names=["user_id", "age", "sex", "occupation", "zip_code"] 5-element Array{ASCIIString,1}: "user_id" "age" "sex" "occupation" "zip_code" julia> u_col_names=[symbol(col_names[i]) for i in 1:size(col_names)[1]] 5-element Array{Any,1}: :user_id :age :sex :occupation :zip_code
Why does the last list comprehension return Array{Any, 1} instead of Array{Symbol, 1} ? Note that the following returns Array{Symbol, 1} :
julia> u_col_names=[symbol("col_names$i") for i in 1:size(col_names)[1]] 5-element Array{Symbol,1}: :col_names1 :col_names2 :col_names3 :col_names4 :col_names5
Interestingly, the following does:
julia> col_names[1] "user_id" julia> symbol(col_names[1]) :user_id julia> [symbol(col_names[1]), symbol(col_names[2])] 2-element Array{Symbol,1}: :user_id :age
What am I missing?
arrays type-inference julia-lang
ajkl
source share