Thanks,I've read about the arrays,but just don't know how to define some
existed type.
though a type may be define as:
type a{T<:Integer}<:Real
xxx
endbut that's will work in my function.I tried to pass different types into a function, so I asked this question. still do not understand why can define a existed type become a subtype of some other type? 2015-09-25 15:11 GMT+08:00 Mauro <[email protected]>: > Julia's parametric types are invariant (except tuples). To figure out > what that means have a read through > > http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types > > > How to make Array{BigFloat,1}<:Array{Real,1}? > > This is always false (that is invariance). But presumably you want a > method which takes any Array with eltype<:Real, try something like: > > julia> f{T<:Real}(ar::Array{T,1}) = typeof(ar) > f (generic function with 1 method) > > julia> f(Array(BigFloat, 2)) > Array{BigFloat,1} >
