Skip to content

Instantly share code, notes, and snippets.

@Quantisan
Created October 25, 2011 15:43
Show Gist options
  • Save Quantisan/1313192 to your computer and use it in GitHub Desktop.
Save Quantisan/1313192 to your computer and use it in GitHub Desktop.
(defn eval-decompose
[coll]
(let [super-d (distinct coll)
freqs (loop [ps []
d super-d]
(if (seq d)
(let [c (count (filter (partial = (first d)) coll))]
(recur (conj ps c) (rest d)))
ps))]
(map #(vector %1 %2) super-d freqs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment