Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(defn freq-map
"Optimized version of the frequency map"
[coll]
(let [freqs (java.util.HashMap.)]
(doseq [val coll]
(.put freqs val (inc (get freqs val 0))))
freqs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment