Well, that only works for the sample provided and not the larger problem of a variable number of groups but it is trivial to extend it to the general case. I simply need to reverse the solution I provided in the original problem description:
- Use any fixed size combination iterator to produce the combination of groups matching the fixed size target
- Use Algorithm::Loops or similar to generate the cartesian product
This is also much simpler than the odometer model solution I came up with last night after posting this. Thanks.