Skip to content

Instantly share code, notes, and snippets.

@jclaggett
Last active December 30, 2015 09:09
Show Gist options
  • Save jclaggett/7807482 to your computer and use it in GitHub Desktop.
Save jclaggett/7807482 to your computer and use it in GitHub Desktop.
(defn sparkline [values]
(let [low (apply min values)
high (apply max values)
bars "▁▂▃▄▅▆▇█"
step (/ (- high low) (dec (count bars)))
scale #(nth bars (int (/ (- % low) step)))]
(apply str (map scale values))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment