If redefine the data structure of mat to be a vector of vectors and then everything works fine, but that seems super cludgey and doesn’t match surrounding code.

One option if you know the number of rows of your matrix is to reinterpret it as a vector of SVectors from StaticArrays.jl. This doesn’t copy any data and works very nicely if you have a small number of rows:

Here are some alternatives using mapslices. Both assume that you have a function myfun(col_vec, scalar) as above. Note ii) adds an additional method to myfun().

Cases:
i) The scalars in vec are the same:

mapslices(x->myfun(x,2), mat, dims=1)

ii) The scalars in vec are the same or different e.g. vec = reshape(rand(3), 1,3)