1

I have a 1D list list={1,2,3,4,5,6,7,8,9} and I would like to partition it according to some specified sizes sizes={2,1,2,4}, where each element in sizes is the number of elements to include in each sublist. The desired result will be result={{1,2},{3},{4,5},{6,7,8,9}}. What would be a simple way to do this with list manipulations?

nanjun
  • 1,297
  • 6
  • 15

0 Answers0