Partitioning into unevenly-sized lists
« Back to notesI can never find this one when I need it, so I’m posting it here:
In[139]:= Partition[
Range[5],
2, 2, {1, 1}, {}
]
Out[139]= {{1, 2}, {3, 4}, {5}}
In[140]:= Partition[
Range[5],
2, 2, {1, 1}, {"a"} (* note that we're not just passing in an empty list this time... *)
]
Out[140]= {{1, 2}, {3, 4}, {5, "a"}}
« Back to notes