plain-text-table-renderer

Clojure
(require '[clojure.string :as str])

(defn render-table
  "Renders a seq of maps as a left-aligned plain-text table."
  [headers rows]
  (let [cells  (mapv (fn [r] (mapv #(str (get r % "")) headers)) rows)
        widths (mapv (fn [i] (apply max (count (name (nth headers i)))
                                     (map #(count (nth % i)) cells)))
                     (range (count headers)))
        line   (fn [vals] (str/join "  " (map-indexed (fn [i v] (format (str "%-" (widths i) "s") v)) vals))))]
    (str/join "\n" (concat [(line (map name headers))
                            (str/join "  " (map #(apply str (repeat % "-")) widths))]
                           (map line cells)))))