float(x) = convert(AbstractFloat, x)
julia> which(float,(Number,))
float(x) at float.jl:121
julia> which(map,(Float64,Number))
map(f, x::Number) at number.jl:46
map(f, x::Number, ys::Number...) = f(x, ys...)
julia> float(10) == map(Float64,10)
true
julia> which(float,(AbstractArray{Number},))
float{T}(A::AbstractArray{T,N}) at float.jl:431
function float{T}(A::AbstractArray{T})
if !isleaftype(T)
error("`float` not defined on abstractly-typed arrays; please convert to a more specific type")
end
convert(AbstractArray{typeof(float(zero(T)))}, A)
end
julia> which(map,(Float64,AbstractArray{Number}))
map(f, A::AbstractArray{T,N}) at abstractarray.jl:1305
function map(f, A::AbstractArray)
if isempty(A)
return isa(f,Type) ? similar(A,f) : similar(A)
end
first = f(A[1])
dest = similar(A, typeof(first))
dest[1] = first
return map_to!(f, 2, dest, A)
end