Talk:Permutations by swapping: Difference between revisions
→Alternative Perl6 version: fixed code
(→Alternative Perl6 version: fixed code) |
|||
Line 57:
<lang perl6>multi postfix:<!±>(@a where 1) { [@a] => +1 }
multi postfix:<!±>(@a) {
}
}
say .perl for <a b c>!±</lang>
I think it's easier to understand but it doesn't return the permutations in the correct order:
Line 75 ⟶ 73:
["b", "a", "c"] => -1
["b", "c", "a"] => 1
["c", "a", "b"] =>
["c", "b", "a"] => -1
</pre>
|