-
-
Save deanrad/82ba4bb148c25917b51f9d30e93504e5 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
(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