Skip to content

Instantly share code, notes, and snippets.

@Crowbrammer
Created June 13, 2022 00:37
Show Gist options
  • Save Crowbrammer/828dc816052428612e1da14cd3a7284d to your computer and use it in GitHub Desktop.
Save Crowbrammer/828dc816052428612e1da14cd3a7284d to your computer and use it in GitHub Desktop.
Simple Pig Latin
(ns piglatin)
(defn piglify
"First letter last. Add \"ay\". Leave punctuation alone."
[s]
(if (re-find #"[\.!?,]" s)
s
(str (subs s 1) (subs s 0 1) "ay")))
(defn pig-it [s]
(clojure.string/join " "
(map piglify (clojure.string/split s #" "))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment