比较优雅的写法
julia> Point{T} = Vector{T}
Array{T,1} where T
julia> Edge{T} = Vector{Vector{T}}
Array{Array{T,1},1} where T
julia> Dict{Point{T1}, Edge{T2}} where {T1<:Number, T2<:Number}
Dict{Array{T1,1},Array{Array{T2,1},1}} where T2<:Number where T1<:Number
julia> PE_Dict{T1,T2} = Dict{Point{T1}, Edge{T2}}
Dict{Array{T1,1},Array{Array{T2,1},1}} where T2 where T1
julia> f(::PE_Dict{T1,T2}) where {T1<:Number, T2<:Number} = nothing
f (generic function with 1 method)
julia> Dict{Array{Int64,1},Array{Array{Float64,1},1}}() |> f
或者直接给 Dict
整体一个名字
julia> PE_Dict = Dict{Array{T1,1}, Array{Array{T2,1},1}} where {T1<:Number, T2<:Number}
Dict{Array{T1,1},Array{Array{T2,1},1}} where T2<:Number where T1<:Number
julia> Dict{Array{Int64,1},Array{Array{Float64,1},1}}() isa PE_Dict
true
其他失败的尝试:
julia> Point = Vector{T} where T <: Number
Array{T,1} where T<:Number
julia> Edge = Vector{Vector{T}} where T <: Number
Array{Array{T,1},1} where T<:Number
julia> Dict{Point, Edge}
Dict{Array{T,1} where T<:Number,Array{Array{T,1},1} where T<:Number}
julia> Dict{Array{Int64,1},Array{Array{Float64,1},1}}() isa Dict{Point, Edge}
false
julia> Point = Vector{<:Number}
Array{#s1,1} where #s1<:Number
julia> Edge = Vector{Vector{<:Number}}
Array{Array{T,1} where T<:Number,1}
julia> Dict{Point, Edge}
Dict{Array{#s1,1} where #s1<:Number,Array{Array{T,1} where T<:Number,1}}
julia> Dict{Array{Int64,1},Array{Array{Float64,1},1}}() isa Dict{Point, Edge}
false