Skip to content

Instantly share code, notes, and snippets.

@duarten
Forked from unclebob/commatize
Created February 7, 2012 18:27
Show Gist options
  • Save duarten/1761115 to your computer and use it in GitHub Desktop.
Save duarten/1761115 to your computer and use it in GitHub Desktop.
A function to format a number with commas
(defn commatize [n]
(->> n str reverse (partition-all 3) (interpose \,) flatten reverse (apply str)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment