Skip to content

Instantly share code, notes, and snippets.

@msszczep
Created May 4, 2018 04:01
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/d41f8a5dd95cad6b8312868302c4f13f to your computer and use it in GitHub Desktop.
Save msszczep/d41f8a5dd95cad6b8312868302c4f13f to your computer and use it in GitHub Desktop.
letters->numbers in Clojure
(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