Say I have an array of the form:
ExampleArray = {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}};
I'd like to be able to reversibly merge sets of $k$ adjacent elements together s.t. I can go back and forth from, for example, arrays of the form:
ExampleArray = {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}};
And, for $k = 2$:
ExampleArray2Star = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13}};
Or, for $k = 3$:
ExampleArray3Star = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13}};
As we can see here, "leftover" elements at the end of the array will strictly be in a subset of size $\leq k$.
Is there a name for this sort of operation, and is there an easy way to execute it in Mathematica 9.0?
Range@13. – Jul 11 '13 at 14:02