Find words which contains all the vowels: Difference between revisions

m
Line 1,269:
or, adding the restriction to words of more than 10 characters, and using Data.Set to identify words with a set of 5 unique vowel characters, which have no more than 5 vowel characters in total:
 
<syntaxhighlight lang="haskell">import Data.SetList (Set, fromList, member, sizepartition)
import Data.Set (Set, fromList, member, size)
 
---- WORDS OVER 10 CHARS WHICH CONTAIN EACH VOWEL ONCE ---
Line 1,278 ⟶ 1,279:
eachVowelOnce :: String -> Bool
eachVowelOnce w =
all (5 ==) $
let vs = filter (`member` vowels) w
in 5 == [length, vssize &&. 5fromList] ==<*> size[filter (fromList`member` vsvowels) w]
 
vowels :: Set Char
9,659

edits