map() loses the type of empty arrays

85 views
Skip to first unread message

Parsifal Herzog

unread,
Feb 8, 2014, 4:02:27 AM2/8/14
to juli...@googlegroups.com
This is an an application of an identity function:

julia> map(z::Int->z, Array(Int,1))
1-element Array{Int64,1}:
 36746368

So it is. This is also:

julia> map(z::Int->z, Array(Int,0))
0-element Array{Any,1}

This result seems incorrect. Is this the intended result?

Kevin Squire

unread,
Feb 8, 2014, 3:32:02 PM2/8/14
to juli...@googlegroups.com
Are you referring to the fact that the return type is Array{Any,1}, instead of Array{Int64,1}?  This is actually intentional: https://github.com/JuliaLang/julia/issues/3349

That said, inference in the map function could generally be improved.  See


Cheers,

   Kevin
Reply all
Reply to author
Forward
0 new messages