Created
June 13, 2022 00:37
-
-
Save Crowbrammer/828dc816052428612e1da14cd3a7284d to your computer and use it in GitHub Desktop.
Simple Pig Latin
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
(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