Find words which contain the most consonants: Difference between revisions
Find words which contain the most consonants (view source)
Revision as of 16:45, 25 July 2022
, 1 year ago→{{header|Haskell}}: Added a 'no consonant used twice' variant of the test
(→{{header|Haskell}}: Expanded preamble (ambiguous task description)) |
(→{{header|Haskell}}: Added a 'no consonant used twice' variant of the test) |
||
Line 1,511:
("incomprehensible",9)
("knightsbridge",9)</pre>
or adjusting the test above to return only words which use no consonant twice:
<lang haskell>main :: IO ()
main =
readFile "unixdict.txt"
>>= mapM_ (mapM_ print)
. fmap (filter noConsonantTwice)
. take 1
. uniqueGlyphCounts consonants
. lines
noConsonantTwice :: (String, Int) -> Bool
noConsonantTwice =
uncurry
( (==)
. length
. filter (`S.member` consonants)
)</lang>
{{Out}}
<pre>("comprehensible",9)</pre>
=={{header|J}}==
|