Let’s say you have
[[0 1 2] [3 4 5] [6 7 8]] and you want to transpose that
[[0 3 5] [1 4 7] [2 5 8]]. There is a simple idiom that takes care of
Let’s break this down. Our end goal is to get something like
You can get this by grouping each of the columns into a vector and mapping over them
The only problem is that our input is a vector of vectors. Using
will splat the vector (i.e. embed, or flatten, them into the call), so you end
up with the three vectors.