Initialize array of arrays

Note, as said above, that fill will initialize the array of arrays with the same array:

julia> a = fill(Int[],2,2)
2×2 Array{Array{Int64,1},2}:
 Int64[]  Int64[]
 Int64[]  Int64[]

julia> push!(a[1,1],1)
1-element Array{Int64,1}:
 1

julia> a
2×2 Array{Array{Int64,1},2}:
 [1]  [1]
 [1]  [1]

2 Likes