Created
June 2, 2013 14:40
-
-
Save lattejed/5693734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Make a pattern to match the consonants and vowels in a word where a cons is | |
-- not "aeiou" or y preceded by a cons e.g., "happy" -> ("happy", "cvccv") | |
wordDesc :: String -> (String, String) | |
wordDesc str = (str, [corv (a,b,i) | (a,b,i) <- zip3 str (rotateR str) [0..len]]) | |
where len = length str - 1 | |
corv (a,b,i) | |
| a == 'y' && i /= 0 && b `notElem` vs = 'v' | |
| a `elem` vs = 'v' | |
| otherwise = 'c' | |
where vs = "aeiou" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment