Often I'm using matrices as collections of vectors, for example each column of the matrix is a vector.
If I want to iterate through the vectors, I find myself doing: for i in 1:size(mat, 2) # do stuff with mat[:, i] end Is there a way to treat the matrix as an iterable, something like for v in cols(mat) # do stuff with v end or more generally for v in slices(mat, 2) # do stuff with v end I could use mapslices with the do notation like mapslices(mat, 2) do v # do stuff with v end but that creates an anon function, which I've heard is somewhat slow, is that still correct? I'm just looking for feedback on what the most Julian thing to do here is, as I find I'm doing this quite a bit in my code. -s