I'm trying to write a Julia function, which can accept both 1-dimensional Int64 and Float64 array as input argument. How can I do this without defining two versions, one for Int64 and another for Float64?
I have tried using Array{Real,1} as input argument type. However, since Array{Int64,1} is not a subtype of Array{Real,1}, this cannot work.
Array{<:Real,1}
? – ig0774<:Real
specifies that it’s an array containing a subtype ofReal
, i.e., Julia treats it as a parametric type, if that makes sense... – ig0774