Best I did wa*s *376 characters and that's with minifying*.
***
http://codegolf.stackexchange.com/questions/8797/ode-cay-olf-gay/8856#8856
Basically if the word starts with a vowel postfix "-ay"
If it doesn't have any vowels postfix "ay"
Otherwise take the first letter postfix "-" first letter "ay"
(defn no-vowel [a b]
(reduce #(and % %2) (map #(= (.indexOf a %) -1) (map string/lower-case
(rest b)))))
(defn transform [text]
(let [vowels ["a" "e" "i" "o" "u"]]
(if (> (.indexOf vowels (string/lower-case (first text))) -1)
(str text "-way")
(if (no-vowel vowels text)
(str text "ay")
(str (reduce str (rest text)) "-" (first text) "ay")))))
(defn ay-ya [text]
(reduce str
(map #(str (transform %) " ")
(string/split text #" "))))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en