Initialize an array of arrays in Julia
julia
Solution
If you want an array of arrays as opposed to a matrix (i.e. 2-dimensional `Array`):
a = Array[ [1,2], [3,4] ]
You can parameterize (specify the type of the elements) an `Array` literal by putting the type in front of the `[]`. So here we are parameterizing the `Array` literal with the `Array` type. This changes the interpretation of brackets inside the literal declaration.
Problem
I'm trying to create an array of two arrays. However, `a = [[1, 2], [3, 4]]` doesn't do that, it actually concats the arrays. This is true in Julia: `[[1, 2], [3, 4]] == [1, 2, 3, 4]`. Any idea? As a temporary workaround, I use `push!(push!(Array{Int, 1}[], a), b)`.