Skip to content

Instantly share code, notes, and snippets.

@mbateman
Created July 16, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbateman/c2fe1c7d7ae1214fef663ebf04247dbd to your computer and use it in GitHub Desktop.
Save mbateman/c2fe1c7d7ae1214fef663ebf04247dbd to your computer and use it in GitHub Desktop.
(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