Flattening a vector of vectors

What command will let me flatten a vector of vectors?

I believe the package “Iterations” had this “flatten” command, but it appears to be deprecated.

Iterators.flatten still works fine:

julia> Iterators.flatten([[1,2], [3,4]])
Base.Iterators.Flatten{Vector{Vector{Int64}}}([[1, 2], [3, 4]])

julia> collect(Iterators.flatten([[1,2], [3,4]]))
4-element Vector{Int64}:
 1
 2
 3
 4

Alternatively, if you want it materialized do one of:

julia> vv = [[1,2], [3,4]]
2-element Vector{Vector{Int64}}:
 [1, 2]
 [3, 4]

julia> vcat(vv...)
4-element Vector{Int64}:
 1
 2
 3
 4

julia> reduce(vcat, vv)
4-element Vector{Int64}:
 1
 2
 3
 4
3 Likes

reduce(vcat, vv) worked in my case