Jump to content

Find words which contain the most consonants: Difference between revisions

→‎{{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}}==
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.