The OP includes a 9-element list:
list = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12}, {13, 14, 15,
16}, {17, 18, 19, 20, 21, 22, 23}, {24}, {25, 26}, {27}, {4}}
For dividing the number 9 it into bins, consider:
QuotientRemainder[
Length@list, #] /. {a_, b_} :> {Sequence @@ ConstantArray[#, a],
If[b != 0, b, Nothing]} & /@ Range[5]
{{1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 1}, {3, 3, 3}, {4, 4,
1}, {5, 4}}
Define a function to Catenate n lists together using TakeList:
nCatenate[list_List, n_Integer] :=
Catenate /@
TakeList[list,
QuotientRemainder[Length@list,
n] /. {a_, b_} :> {Sequence @@ ConstantArray[n, a],
If[b != 0, b, Nothing]}]
nCatenate[list, 3]
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, {13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24}, {25, 26, 27, 4}}
nCatenate[list, 2]
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15, 16}, {17, 18,
19, 20, 21, 22, 23, 24}, {25, 26, 27}, {4}}
One can decide if the last (left over) items are to be kept.
Addendum
Another way of realizing sublist counts as shown above can be:
ips = IntegerPartitions[9]
Last /@ (MaximalBy[ips, Count[#]] & /@ Range[5])
{{1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 1}, {3, 3, 3}, {4, 4,
1}, {5, 1, 1, 1, 1}}
PartitionandJoin. – b.gates.you.know.what Sep 13 '13 at 11:22Join @@@ Partition[list, 3], but depends a lot on what you plan to do – Pinguin Dirk Sep 13 '13 at 11:25Flatten, it'd be like:Flatten /@ Partition[list, 3]. But again, not knowing where you are headed, it's hard to provide a "real" answer – Pinguin Dirk Sep 13 '13 at 11:27