4 ms·
(frequencies "abcaaabcccaabrrcb")
by herdrick 16y ago
(frequencies "abcaaabcccaabrrcb")
- Avshalom 16y agoas a note, the source is: (defn frequencies "Returns a map from distinct items in coll to the number of times they appear." {:added "1.2"} [coll] (persistent! (reduce (fn [counts x] (assoc! counts x (inc (get counts x 0)))) (transient {}) coll))) which I think is pretty much just Raphael's solution.