Tuesday, January 11, 2011

View Data from the Clojure REPL

Here's a nice debugging feature in Clojure. The inspect module lets you look at variables in a popup JFrame. The two examples below show how you quickly view data in a table or tree format. This is really handy to quickly view data from the REPL.

(require 'clojure.inspector)

(clojure.inspector/inspect-tree '(1 (a b) 2 (c d) 3 (e f )))

(clojure.inspector/inspect-table '((1 2 3) (a b c) (e f g)))


No comments: