apple/swift-algorithms

Unique combinations from a collection

peterbayerle opened this issue · 1 comments

I noticed there’s a method for counting the unique permutations of a collection - how come there is no equivalent for combinations? For example the unique combinations of length 2 of “aabc” are “aa”, “ab”, “ac”, “bc”. If others think this would be useful Id be interested in trying to implement it !

An equivalent would be more_itertools.distinct_combinations(collection, k) in Python

I think this is in there now. But it's misnamed. It should have "subsets" in the name (and no, it doesn't matter that it doesn't create a Set data structure).