Skip to content

Instantly share code, notes, and snippets.

@sarahhodne sarahhodne/spark.clj
Created May 28, 2012

Embed
What would you like to do?
(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
You can’t perform that action at this time.