Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ClearAll@splitList;
- splitList[1][list_] := {list};
- splitList[parts_Integer][list_] :=
- With[{n = Ceiling[Length[list]/parts]},
- Partition[list, UpTo[n]] //
- Replace[
- {prev : Repeated[{___}, parts - 1]} :>
- {prev, Apply[Sequence]@Table[{}, {parts - Length@{prev}}] }
- ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement