Find the missing permutation: Difference between revisions

→‎{{header|Haskell}}: Dropped one redundant import, narrowed the others. Dropped a redundant 'do', applied hindent.
No edit summary
(→‎{{header|Haskell}}: Dropped one redundant import, narrowed the others. Dropped a redundant 'do', applied hindent.)
Line 990:
 
=={{header|Haskell}}==
{{works with|GHC|67.10+.3}}
<lang haskell>import Data.List ((\\), permutations, nub)
import Control.Monad (join)
import Control.Arrow
 
missingPerm :: Eq a => [[a]] -> [[a]]
:: Eq a
=> [[a]] -> [[a]]
missingPerm = (\\) =<< permutations . nub . join
 
deficientPermsList =:: ["ABCD","CABD","ACDB","DACB",String]
deficientPermsList =
"BCDA","ACBD","ADCB","CDAB",
[ "ABCD"
"DABC","BCAD","CADB","CDBA",
, "CABD"
"CBAD","ABDC","ADBC","BDCA",
, "ACDB"
"DCBA","BACD","BADC","BDAC",
, "DACB"
"CBDA","DBCA","DCAB"]
, "BCDA"
, "ACBD"
, "ADCB"
, "CDAB"
, "DABC"
, "BCAD"
, "CADB"
, "CDBA"
, "CBAD"
, "ABDC"
, "ADBC"
, "BDCA"
, "DCBA"
, "BACD"
, "BADC"
, "BDAC"
, "CBDA"
, "DBCA"
, "DCAB"
]
 
main =:: doIO ()
main = print $ missingPerm deficientPermsList</lang>
{{outOut}}
<pre>["DBAC"]</pre>
 
=={{header|Icon}} and {{header|Unicon}}==
9,659

edits