Find the missing permutation: Difference between revisions
m
→Python:Folding XOR over the set of strings: (:Pruned out some scaffolding)
(→Haskell :: Folding XOR over the list of permutations: Added XOR variant.) |
m (→Python:Folding XOR over the set of strings: (:Pruned out some scaffolding)) |
||
Line 2,591:
from functools import reduce
from operator import xor
print(''.join([
), [▼
'
'
▲ 'BADC', 'BDAC', 'CBDA', 'DBCA', 'DCAB'
[0, 0, 0, 0]
▲ chr(i) for i in reduce(
▲ lambda a, s: map(xor, a, codes(s)),
▲ xs[1:],
▲ )
▲ return [ord(c) for c in list(s)]
▲ main()</lang>
{{Out}}
<pre>DBAC</pre>
|