concept print - table in category clojure

appears as: print-table
Clojure: The Essential Reference

This is an excerpt from Manning's book Clojure: The Essential Reference.

A final mention for print-table, a function that renders Clojure maps as two-dimensional tables:

(require '[clojure.pprint :as pretty])

(pretty/print-table (repeat 4 (zipmap (range 10) (range 100 110)))) ; #1

;; |   0 |   7 |   1 |   4 |   6 |   3 |   2 |   9 |   5 |   8 |
;; |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
;; | 100 | 107 | 101 | 104 | 106 | 103 | 102 | 109 | 105 | 108 |
;; | 100 | 107 | 101 | 104 | 106 | 103 | 102 | 109 | 105 | 108 |
;; | 100 | 107 | 101 | 104 | 106 | 103 | 102 | 109 | 105 | 108 |
;; | 100 | 107 | 101 | 104 | 106 | 103 | 102 | 109 | 105 | 108 |

print-table uses the keys of the first map to define the headers for the table. We can override the choice of column names using the first argument: