Find words which contain the most consonants: Difference between revisions
Find words which contain the most consonants (view source)
Revision as of 11:44, 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,495 ⟶ 1,496:
main :: IO ()
main =
readFile "unixdict.txt"
take 1 . uniqueGlyphCounts consonants . lines▼
. take 1
. lines</lang>
{{Out}}
<pre>("bremsstrahlung",9)
|