I want to reshape the standard Vec
. Although this can be achieved using a for loop, I'm wondering if there is a better way. I'd like to reshape this:
let before = [1, 2, 3, 4, 5, 6, 7, 8, 9, /* ... */];
Into this:
let after = [[1,4,7], [2,5,8], [3,6,9], /* ... */];
It should be flexible such that I can make a function with a size argument, example:
let size_2 = [[1,3], [2,4], [3,5], /* ... */]; // size = 2