Any ... but not that much

a=[]; b=[];

julia> c=[a b]
0×2 Array{Any,2}

julia> c=[1 b]
ERROR: DimensionMismatch("mismatch in dimension 1 (expected 1 got 0)")

This highly reduces the usefulness of the Any’s. In Matlab we can do

>> c={1 []};
>> if isempty(c{2}), c{2}=3; end
>> c

c = 

    [1]    [3]

and I really wished that the same works in Julia

When you use the space-delimited syntax in Julia, you are requesting arrays to be concatenated together. If you want the cell-like behavior, you need to use commas:

julia> c = [a, b]
2-element Array{Array{Any,1},1}:
 Any[]
 Any[]

julia> c = [1, b]
2-element Array{Any,1}:
 1
  Any[]
1 Like

Tricky, but good to know. Thanks.

Consider also that you were using a 2 dimensional array instead of a 1 dimensional array (a vector).