How to create a 2x1 Array?

How about a macro?

julia> using MacroTools

julia> macro col(expr)
         @capture expr [x__]
         Expr(:call, :hvcat, Expr(:tuple, [1 for _ in x]...), esc.(x)...)
       end
@col (macro with 1 method)

julia> @col [1,2]
2×1 Array{Int64,2}:
 1
 2

julia> @col [1, 2, 3]
3×1 Array{Int64,2}:
 1
 2
 3
2 Likes