I know there's a way to split a list into parts of a specific length, and I know there's a way to get all possible partitions of an integer. But I was wondering if there's a way to partition a list into, say, three parts. Kind of like the balls and dividers method, except that it actually returns the number of balls between each set of dividers. So if I put in something like:
f[4,2] or f[{1,1,1,1},2]
it will return
{2,2},{1,3},{3,1} or {{1,1},{1,1}},{{1},{1,1,1}},{{1,1,1},{1}}