The rule is: - Commas create a 1D array. - Spaces and semicolons give 2D arrays.
Julia makes a clear distinction between these, hence these two notations cannot be mixed. -erik On Wed, Mar 23, 2016 at 8:24 AM, Colin Beckingham <[email protected]> wrote: > If I declare an array a using commas as: > > a = [1,2,3;4,5,6] > ERROR: syntax: unexpected semicolon in array expression > in eval(::Module, ::Any) at ./boot.jl:243 > > However without commas I get: > > a = [1 2 3;4 5 6] > 2x3 Array{Int64,2}: > 1 2 3 > 4 5 6 > > I'm aware I can use reshape on a vector to get a result, but I guess I am > not appreciating a subtlety of the presence of the commas. > Could someone kindly point to the fundamental parsing principle at work in > this instance? -- Erik Schnetter <[email protected]> http://www.perimeterinstitute.ca/personal/eschnetter/
