Find words which contains all the vowels: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: filter rather than partition (simpler here)) |
m (→{{header|Haskell}}: (simpler)) |
||
Line 1,279: | Line 1,279: | ||
eachVowelOnce :: String -> Bool |
eachVowelOnce :: String -> Bool |
||
eachVowelOnce w = |
eachVowelOnce w = |
||
let vs = filter (`member` vowels) w |
|||
in 5 == length vs && 5 == size (fromList vs) |
|||
filter (`member` vowels) w |
|||
vowels :: Set Char |
vowels :: Set Char |
||
Line 1,290: | Line 1,289: | ||
main = |
main = |
||
readFile "unixdict.txt" |
readFile "unixdict.txt" |
||
>>= (mapM_ putStrLn . filter p . lines) |
>>= (mapM_ putStrLn . filter p . lines)</syntaxhighlight> |
||
------------------------- GENERIC ------------------------ |
|||
both :: (a -> b) -> (a, a) -> (b, b) |
|||
both f ~(x, y) = (f x, f y)</syntaxhighlight> |
|||
{{Out}} |
{{Out}} |
||
<pre>ambidextrous |
<pre>ambidextrous |