Remove single-element permutations
This commit is contained in:
parent
ade18b5ccf
commit
12572889a1
@ -22,6 +22,7 @@ class Permutation {
|
||||
*/
|
||||
operator fun times(perm: Permutation)
|
||||
= Permutation(this(*perm(*orderedElements)).zip(orderedElements) // Generate transpositions
|
||||
.filterNot{ it.first == it.second }
|
||||
.foldRight(ArrayList<Pair<Char, Char>>()){ // Deduplicate transpositions
|
||||
insert, acc ->
|
||||
acc.firstOrNull {
|
||||
|
Loading…
x
Reference in New Issue
Block a user