4 ms·
No expert, but from the source it looks like it just uses whatever a 'map' uses to match keys: (defn frequencies "Returns a map from distinct items in co
by GregWright 13y ago
No expert, but from the source it looks like it just uses whatever a 'map' uses to match keys:
(defn frequencies
"Returns a map from distinct items in coll to the number of times
they appear."
{:added "1.2"
:static true}
[coll]
(persistent!
(reduce (fn [counts x]
(assoc! counts x (inc (get counts x 0))))
(transient {}) coll)))