frequencies

functionsince v0.0-927 clojure.core/frequenciesEdit
(frequencies coll)

Details:

Returns a map from distinct items in coll to the number of times they appear.

(frequencies [:a :a :b]) => {:a 2, :b 1}


See Also:


Source docstring:
Returns a map from distinct items in coll to the number of times
they appear.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn frequencies
  [coll]
  (persistent!
   (reduce (fn [counts x]
             (assoc! counts x (inc (get counts x 0))))
           (transient {}) coll)))