-
-
Save tomjack/1f1bfe9a3a2dffe8be25 to your computer and use it in GitHub Desktop.
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
(defdesign books/wordcount | |
(wordcount {:map (fn [doc] | |
(for [word (re-seq #"[a-zA-Z']+" (:text doc))] | |
[(.toLowerCase word) 1])) | |
:reduce (fn [k v] (reduce + v)) | |
:rereduce (fn [v] (reduce + v))})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment