Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created December 9, 2009 21:53
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 tomjack/1f1bfe9a3a2dffe8be25 to your computer and use it in GitHub Desktop.
Save tomjack/1f1bfe9a3a2dffe8be25 to your computer and use it in GitHub Desktop.
(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