Iām trying to create an empty vector of vectors and then append vectors to it so that I end up with a ragged array. What is wrong with this code?
julia> a = Vector{Vector{Int}}[]
Vector{Vector{Int64}}[]
julia> x = [1,2]
2-element Vector{Int64}:
1
2
julia> append!(a, copy(x))
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Vector{Vector{Int64}}
julia> a = Vector{Int}[]
Vector{Int64}[]
julia> push!(a, [1,2]);
julia> a
1-element Vector{Vector{Int64}}:
[1, 2]
this is a Vector of Vector{Vector{Int}}, not a Vector of Vector. In order to add a single element to the collection, you want to use push!() not append!()