Skip to content

Instantly share code, notes, and snippets.

@christianromney
Created July 26, 2011 23:10
Show Gist options
  • Save christianromney/1108311 to your computer and use it in GitHub Desktop.
Save christianromney/1108311 to your computer and use it in GitHub Desktop.
Pig-Latin in Clojure
(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)))))
@christianromney
Copy link
Author

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment