Count how many vowels and consonants occur in a string: Difference between revisions
Content deleted Content added
→{{header|Haskell}}: Adjusted output |
|||
Line 212: | Line 212: | ||
(`S.notMember` vs) |
(`S.notMember` vs) |
||
(alphabet <> fmap toUpper alphabet) |
(alphabet <> fmap toUpper alphabet) |
||
--------------------------- TEST ------------------------- |
--------------------------- TEST ------------------------- |
||
main :: IO () |
main :: IO () |
||
main = do |
main = do |
||
let sets = |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
putStrLn "Unique vowels and consonants used, with counts:\n" |
putStrLn "Unique vowels and consonants used, with counts:\n" |
||
print $ |
mapM_ print $ |
||
[(,) . S.toList <*> S.size] |
|||
<*> ( [fst, snd] |
|||
⚫ | |||
"aeiou" |
|||
⚫ | |||
⚫ | |||
] |
|||
⚫ | |||
------------------------- GENERAL ------------------------ |
------------------------- GENERAL ------------------------ |
||
both :: (a -> b) -> (a, a) -> (b, b) |
|||
both = join bimap |
|||
if_ :: Bool -> a -> a -> a |
if_ :: Bool -> a -> a -> a |
||
Line 236: | Line 239: | ||
<pre>Unique vowels and consonants used, with counts: |
<pre>Unique vowels and consonants used, with counts: |
||
("aeiou", |
("aeiou",5) |
||
( |
("Fglmnprtv",9)</pre> |
||
=={{header|jq}}== |
=={{header|jq}}== |