-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Description
In Julia 0.5.0 array initialization is inconsistent when using spaces and semicolons.
julia> [1;2;3]
3-element Array{Int64,1}:
1
2
3
Creates a 3-element rather than a 3x1 array. But, adding a space makes a 3x2 array:
julia> [[1;2;3] [4;5;6]]
3×2 Array{Int64,2}:
1 4
2 5
3 6
Spaces add a second dimension and semicolons add rows, except for the [1;2;3] case.
julia> [1 2 3]
1×3 Array{Int64,2}:
1 2 3
julia> [1 2 3]'
3×1 Array{Int64,2}:
1
2
3
julia> [1 2 3; 4 5 6]
2×3 Array{Int64,2}:
1 2 3
4 5 6
Making initialization consistent so that a semicolon adds a row (i.e. [1;2;3] initialization creates a 3x1 array) makes array initialization more consistent.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels