Dropping a column from a matrix

A mutating version could be faster, if it fits the use-case:

function dropcol!(M, colnum)
    nr = size(M,1)
    M[:,colnum:end-1] .= M[:,colnum+1:end]
    M = reshape(resize!(vec(M), length(M)-nr),nr,:)
end

And a small test:

julia> A
4×9 Matrix{Int8}:
 -120    60  124  -78   63   61   -2    3   -70
 -106    60  -47   30  -97   25  -68   39  -112
 -102  -111   75   26   15  121   80   -3  -119
  -86    90  -16  -91  -90  -39  -96  -66   -25

julia> dropcol!(A, 4)
4×8 Matrix{Int8}:
 -120    60  124   63   61   -2    3   -70
 -106    60  -47  -97   25  -68   39  -112
 -102  -111   75   15  121   80   -3  -119
  -86    90  -16  -90  -39  -96  -66   -25

julia> @btime dropcol!(A, 4) setup=(A = rand(Int8,4,9));
  51.005 ns (5 allocations: 208 bytes)

The benchmark time is faster than other solutions (and less memory allocated).