Skip to content

Instantly share code, notes, and snippets.

@sarahhodne
Created May 28, 2012 09:37
Show Gist options
  • Save sarahhodne/2818174 to your computer and use it in GitHub Desktop.
Save sarahhodne/2818174 to your computer and use it in GitHub Desktop.
(ns spark
(:require [clojure.string]))
(defn spark
[coll]
(let [ticks [\▁ \▂ \▃ \▄ \▅ \▆ \▇]
low (apply min coll)
range (- (apply max coll) low)
scale (- (count ticks) 1)]
(clojure.string/join (map #(get ticks (int (* (/ (- % low) range) scale))) coll))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment