Dict{String,Array{T,1}} where T; 與Dict{String,Array{T,1}where T}兩種類型的區別
其中,
Dict{String,Array{T,1}} where T,只是說明這個數據類型,只能放一種具體的數據類型,比如Dict{String,Array{Int64,1}}或Dict{String,Array{String,1}},但不能都放;
Dict{String,Array{T,1}where T},卻是表明,既可以Dict{String,Array{Int64,1}},也可以Dict{String,Array{String,1}};
julia> instrs = Dict("YLXF"=>[("IC","IH")],"XXXY"=>["IC"])
Dict{
String,Array{
T,1} where T} with 2 entries:
"XXXY" => ["IC"]
"YLXF" => [("IC", "IH")]
julia> s = Dict{
String,Array{
T,1} where T}() ;
julia> setindex!(s,["a"],"a")
Dict{
String,Array{
T,1} where T} with 1 entry:
"a" => ["a"]
julia> setindex!(s,[("a","b")],"b")
Dict{
String,Array{
T,1} where T} with 2 entries:
"b" => [("a", "b")]
"a" => ["a"]
julia> Dict{
String,Array{
T,1} where T} == Dict{
String,Array{
T,1}} where T
false
julia> A = Dict{
String,Array{
T,1}} where T
Dict{
String,Array{
T,1}} where T
julia> typeof(A)
UnionAll
julia> B = Dict{
String,Array{
T,1} where T}
Dict{
String,Array{
T,1} where T}
julia> typeof(B)
DataType