Syntax idea: `[1 M]` to accomplish `hcat( ones(size(M,1)), M )` by broadcasting



If you saw

[1 M]

What would you expect?

I would expect a new column of 1s to be prepended to matrix M. i.e. the 1 would be broadcast.

So it would accomplish:

hcat( ones(size(M,1)), M )

Similarly [1;M] would vcat

What think ye, O creators?


You could also intend for 1 to be the identity matrix, or to get a unit vector. Because the results aren’t clear, it seems better to throw an error and force the user to be explicit.