I'm pretty sure I should be using BinLists[...] but it doesn't behave quite as I expect. Say I have a list of data : Data = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,...}

I want to be able to chop this data into blocks of a certain size, e.g. {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{..}} for blocks of three, or, {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16},{...}} for blocks of four

I try using BinLists[Data,3] but this seems to be out of order giving me {{1,2},{3,4,5},{6,7,8},{9,10,11},{12,13,14},...} rather than in the form I described above.

Is there a way to modify BinLists[...] in some way or an alternative that will achieve what I want.


  • 3
    $\begingroup$ Have you seen Partition? $\endgroup$ – Edmund Aug 19 '17 at 2:43
  • 2
    $\begingroup$ BinLists start counting from 0, that's why there are only 2 elements in {1,2} $\endgroup$ – Alucard Aug 19 '17 at 2:58
  • $\begingroup$ @Edmund no I had not seen this fucntion, thanks very much!! $\endgroup$ – Q.P. Aug 19 '17 at 10:48



if you want to use BinLists write

BinLists[data, {First@data, Last@data, 3}]
| improve this answer | |
  • $\begingroup$ wonderful! Thank you! $\endgroup$ – Q.P. Aug 19 '17 at 10:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.