Created
May 4, 2018 04:01
-
-
Save msszczep/d41f8a5dd95cad6b8312868302c4f13f to your computer and use it in GitHub Desktop.
letters->numbers in Clojure
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 letters->numbers [letters] | |
(let [letter-map (zipmap (map char "abcdefghijklmnopqrstuvwxyz") | |
(range 1 27))] | |
(->> letters | |
(map char) | |
(map letter-map) | |
(reduce +)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment