# New Ticket Created by Michael Schaap # Please include the string: [perl #130472] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130472 >
The permutations and combinations routines both give all possibilities, even if they're not distinct. > <a b b>.permutations ((a b b) (a b b) (b a b) (b b a) (b a b) (b b a)) > <a b b>.combinations(2) ((a b) (a b) (b b)) If you want distinct permutations or combinations, you have to do something like: > <a b b>.permutations.unique(:with(&[eqv])) ((a b b) (b a b) (b b a)) > <a b b>.combinations(2).unique(:with(&[eqv])) ((a b) (b b)) This is not ideal. It would be awesome if we could do something like: > <a b b>.permutations(:distinct) ((a b b) (b a b) (b b a)) > <a b b>.combinations(2, :distinct) ((a b) (b b)) (This potentially has better performance too, depending on the implementation.)