On Feb 28, 5:02*am, Michael Robertson <mcrobert...@hotmail.com> wrote:
> Thanks again for your efforts here. *This particular problem didn't
> appear in any course I took...certainly similar problems did.
And here's the obligatory not-very-obfuscated one-liner:
from itertools import combinations as c; boxings=lambda n,k

[s[i
+1]+~s[i] for i in range(k)] for s in [[-1]+list(t)+[n-~k] for t in
c(range(n-~k),k-1)])
You'll need to check out and compile the
latest svn sources to make it work, though.
And it doesn't work when k == 0.
Mark