Skip to content

Instantly share code, notes, and snippets.

@kaja47
Created February 13, 2012 14:44
Show Gist options
  • Save kaja47/1817363 to your computer and use it in GitHub Desktop.
Save kaja47/1817363 to your computer and use it in GitHub Desktop.
(def letters {
\a 1 \é 3 \k 1 \r 1 \ů 4
\á 2 \ě 3 \l 1 \ř 4 \v 1
\b 3 \f 5 \m 2 \s 1 \x 10
\c 2 \g 5 \n 1 \š 4 \y 2
\č 4 \h 2 \ň 6 \t 1 \ý 4
\d 1 \i 1 \o 1 \ť 7 \z 2
\ď 8 \í 2 \ó 7 \u 2 \ž 4
\e 1 \j 2 \p 1 \ú 5
})
(defn letter-score [a] (if (nil? (letters a)) 0 (letters a)))
(defn word-score [w] [(reduce + 0 (map letter-score w)) w])
(def words (.split (slurp "slova/seznam_slov") "\n"))
(println (take 10 (sort-by first > (map word-score words))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment