clojure.inspector provides a small user interface for quickly navigating and visualizing structured Clojure data. It wraps data in a basic Java Swing window rather than transforming or analyzing it. section 22.2
Choose a visualization model according to the data shape:
- Use a tree-like view for nested structures such as maps containing vectors and further maps. section 22.2
- Use a tabular view for a group of collections with matching keys or matching sizes. section 22.2
- Expect the first record or item list to establish the table size; inconsistent data shapes may display incorrectly. section 22.2
- Treat the utility as a quick viewer: it offers little configuration or extensibility. section 22.2
(require '[clojure.inspector :refer [inspect-tree]]) ; #1
(inspect-tree {:a 1 :b 2 :c [1 2 3 {:d 4 :e 5 :f [6 7 8]}]}) ; #2
Inspect a nested map with inspect-tree to open a navigable visualization of its maps, vectors, and scalar values. section 22.2
(require '[clojure.inspector :refer [inspect-table]]) ; #1
(def events [{:time "2017-05-04T13:08:57Z" :msg "msg1"} ; #2
{:time "2017-05-04T13:09:52Z" :msg "msg2"}
{:time "2017-05-04T13:11:03Z" :msg "msg3"}
{:time "2017-05-04T23:13:10Z" :msg "msg4"}
{:time "2017-05-04T23:13:23Z" :msg "msg5"}])
(inspect-table events)
;; See image below
Inspect a uniform sequence of event maps with inspect-table to view matching records as a table. section 22.2
