Find words which contain the most consonants: Difference between revisions

m
Line 1,481:
uniqueGlyphCounts :: S.Set Char -> [String] -> [[(String, Int)]]
uniqueGlyphCounts glyphs ws =
groupBy (on (==) snd) $
. sortOn (Down . snd) $
$ ( ((,) <*> (S.size . S.intersection glyphs . S.fromList))
<$> ws
)
 
--------------------------- TEST -------------------------
Line 1,495 ⟶ 1,496:
main :: IO ()
main =
readFile "unixdict.txt"
take 1 . uniqueGlyphCounts consonants . lines
<$> readFile "unixdict.txt" >>= mapM_ (mapM_ print)</lang>
. take 1
take 1 . uniqueGlyphCounts consonants . lines
. lines</lang>
{{Out}}
<pre>("bremsstrahlung",9)
9,655

edits