Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created July 27, 2011 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/ecd32c48fb704f1b0e73 to your computer and use it in GitHub Desktop.
Save tomjack/ecd32c48fb704f1b0e73 to your computer and use it in GitHub Desktop.
user> (->> ["foo" "foo" "bar" "foo" "baz" "bing" "bing" "foo" "bar"]
(reductions (fn [[m i] v]
(->> m count (get m v) (assoc m v) ((juxt identity #(% v)))))
nil)
next
(map second))
(0 0 1 0 2 3 3 0 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment