Find words which contain the most consonants: Difference between revisions
Find words which contain the most consonants (view source)
Revision as of 11:48, 25 July 2022
, 1 year ago→{{header|Haskell}}
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,497 ⟶ 1,495:
main =
readFile "unixdict.txt"
>>= mapM_ (mapM_ print)
. take 1
. uniqueGlyphCounts consonants
. lines</lang>
{{Out}}
|