Jump to content

Como fazer uma função duplicar fold em haskell


Recommended Posts

A função duplicarFold :: String -> String repete duas vezes cada vogal (letras 'a', 'e', 'i', 'o', 'u' minúsculas ou maiúsculas) numa cadeia de carateres; os outros carateres devem ficar inalterados. Por exemplo, 

duplicar "Ola, mundo!"== "OOlaa, muundoo!"

Da forma que fiz não esta funcionando:

duplicarFold :: String -> String 
duplicarFold xs = foldr (\x acc-> if elem x vogais then else ) [] xs
  vogais = "aeiouAEIOU"


Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.