Skip to content

Instantly share code, notes, and snippets.

@msszczep
Last active August 29, 2015 14:19
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 msszczep/d572f265e8318ccddbcd to your computer and use it in GitHub Desktop.
Save msszczep/d572f265e8318ccddbcd to your computer and use it in GitHub Desktop.
Clojure rewrite of Scrabble surnames' scorer
; See http://www.szcz.org/blog/?cat=33 for context
(let [surnames (->> (slurp "/Users/msszczep1/current_2011-01-2.txt")
(clojure.string/split-lines)
distinct)
points {\A 1 \B 3 \C 3 \D 2 \E 1 \F 4 \G 2 \H 4 \I 1 \J 8 \K 5 \L 1 \M 3
\N 1 \O 1 \P 3 \Q 10 \R 1 \S 1 \T 1 \U 1 \V 4 \W 4 \X 8 \Y 4 \Z 10 \- 0 \' 0}
scores (map #(reduce + (map points (seq %))) surnames)]
(->> (zipmap surnames scores)
(sort-by val)
reverse))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment