Skip to content

Instantly share code, notes, and snippets.

@sshine
Created April 14, 2014 15:11
Show Gist options
  • Save sshine/10656899 to your computer and use it in GitHub Desktop.
Save sshine/10656899 to your computer and use it in GitHub Desktop.
replaceEs :: String -> String
-- One way
replaceEs ('e':cs) = 'a' : replaceEs cs
replaceEs (c:cs) = c : replaceEs cs
replaceEs [] = []
-- Or another
replaceEs [] = []
replaceEs (c:cs) =
case c of
'e' -> 'a' : replaceEs cs
_ -> c : replaceEs cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment