Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (11 sloc) 462 Bytes
; From http://java.ociweb.com/mark/clojure/article.html
(def vowel? (set "aeiou"))
(defn pig-latin [word] ; defines a function
; word is expected to be a string
; which can be treated like a sequence of characters.
(let [first-letter (first word)] ; assigns a local binding
(if (vowel? first-letter)
(str word "ay") ; then part of if
(str (subs word 1) first-letter "ay")))) ; else part of if
(pig-latin "hello")
(pig-latin "vimclojure")