Created
July 16, 2016 12:46
-
-
Save mbateman/c2fe1c7d7ae1214fef663ebf04247dbd to your computer and use it in GitHub Desktop.
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
(def first-name | |
{"a" "Ally-Pally" | |
"b" "Bongo" | |
"c" "Chippers" | |
"d" "Dingo" | |
"m" "Muffy"}) | |
(def second-name | |
{"a" "Anstruther" | |
"b" "Beaufort" | |
"c" "Cholmondeley" | |
"d" "De Lisle" | |
"m" "Mountbatten" | |
}) | |
(def third-name | |
{"a" "Arbuthnot" | |
"b" "Battenburg" | |
"c" "Coutts" | |
"d" "Drummond" | |
"m" "Molyneux" | |
"o" "Oppenheimer" | |
}) | |
(defn get-first-name [character] | |
(get first-name (clojure.string/lower-case character))) | |
(defn sloane-first-name [firstname] | |
(get-first-name (first firstname))) | |
(defn get-second-name [character] | |
(get second-name (clojure.string/lower-case character))) | |
(defn sloane-second-name [secondname] | |
(get-second-name (first secondname))) | |
(defn get-third-name [character] | |
(get third-name (clojure.string/lower-case character))) | |
(defn sloane-third-name [thirdname] | |
(get-third-name (second thirdname))) | |
(defn sloane-name [name] | |
(let [first-name (first (clojure.string/split name #" ")) | |
second-name (second (clojure.string/split name #" "))] | |
(str (sloane-first-name first-name) " " | |
(sloane-second-name second-name) "-" | |
(sloane-third-name second-name) | |
)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment