关于Julia类型语法的问题:为什么数组{Int32,1}<;:数组{整数,1}假?
在茱莉亚关于Julia类型语法的问题:为什么数组{Int32,1}<;:数组{整数,1}假?,julia,Julia,在茱莉亚 Array{Int32, 1} <: Array{Integer, 1} 计算结果为true,因为Int32请参见手册 具有不同T值的具体点类型决不是彼此的子类型: julia>Point{Float64}Point{Float64} 基本上,它是对向量{Integer}含义的语法选择。有三种类型可供选择: julia> Vector{Int32} <: (Vector{T} where T <: Integer) true julia> Vecto
Array{Int32, 1} <: Array{Integer, 1}
计算结果为true
,因为Int32请参见手册
具有不同T
值的具体点
类型决不是彼此的子类型:
julia>Point{Float64}Point{Float64}
基本上,它是对向量{Integer}
含义的语法选择。有三种类型可供选择:
julia> Vector{Int32} <: (Vector{T} where T <: Integer)
true
julia> Vector{Any} <: (Vector{T} where T >: Integer)
true
julia> Vector{Integer} <: (Vector{T} where {T >: Integer, T <: Integer})
true
julia>Vector{Int32}Vector{Integer}:Integer,T这很有意义!非常感谢。
julia> Point{Float64} <: Point{Int64}
false
julia> Point{Float64} <: Point{Real}
false
julia> Vector{Int32} <: (Vector{T} where T <: Integer)
true
julia> Vector{Any} <: (Vector{T} where T >: Integer)
true
julia> Vector{Integer} <: (Vector{T} where {T >: Integer, T <: Integer})
true