Created
July 12, 2016 22:36
-
-
Save craig-ludington/326e26b1e57a5f1d2cc4bc93e07d33db 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
(defn score | |
[word] | |
(let [wc (count word) | |
uc (count (into #{} (map identity (clojure.string/lower-case word))))] | |
{:word word :score (if (= wc uc) wc 0)})) | |
(defn winner | |
[words] | |
(let [m (group-by :score (map score words))] | |
(m (apply max (keys m))))) | |
;; (winner (clojure.string/split-lines (slurp "/usr/share/dict/web2"))) | |
;; => [{:word "dermatoglyphics", :score 15}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment