Created
July 26, 2011 23:10
-
-
Save christianromney/1108311 to your computer and use it in GitHub Desktop.
Pig-Latin in Clojure
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
(defn pig-latin [word] | |
(let [first-letter (first word) remaining (apply str (rest word)) vowel? (set "aeiou")] | |
(if (vowel? (first remaining)) | |
(str remaining first-letter "ay") | |
(recur (str remaining first-letter))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
was right the first time. using the set function converts the string to chars. using the literal requires using the char syntax: #{\a \e \i \o \u}