I'm trying to generate all n-item combinations of a list of numbers while maintaining numerical order. So for example, if the list were
[1,2,3,4]
The ordered combinations of length 3 would be:
[1,2,3]
[2,3,4]
[1,2,4]
[1,3,4]
To be clear, I have to maintain numerical order, so [1,4,2] would not be a desired outcome.
Is there a function that does this, or a fast algorithm that would get it done? The actual list is 111 and I will be choosing 100 items. Thanks.