Created
December 31, 2014 03:54
-
-
Save qwtel/7832b4668aa8d1dabf58 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 usrnames) | |
(require '[clojure.string :as str]) | |
(def file (slurp "/usr/share/dict/words" :encoding "ASCII")) | |
(def words (str/split-lines file)) | |
(defn remove-vowels [word] | |
(->> | |
word | |
str/lower-case | |
(filter #(not= %1 \a)) | |
(filter #(not= %1 \e)) | |
(filter #(not= %1 \i)) | |
(filter #(not= %1 \o)) | |
(filter #(not= %1 \u)) | |
str/join | |
) | |
) | |
(->> | |
words | |
(map remove-vowels) | |
(map vector words) ; zip with original | |
(filter (fn [[_ usrname]] (= 5 (count usrname)))) | |
(group-by (fn [[_ usrname]] usrname)) | |
(map (fn [[usrname group]] (str usrname " (" (str/join ", " (map first group)) ")"))) | |
(str/join "\n") | |
(spit "usrnames.txt") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment