brandonbloom/fipp — pull request #19 by mkremins (2014-10-19 22:41:57+00:00)
Title: Implement code dispatch

(This PR addresses issue #9. Also bringing in @arrdem since he expressed interest in this earlier.)

This probably isn't actually ready to be merged yet. Some design questions are still open, and several fairly common special forms and core macros are still missing special-cased pretty formatting. However, I'm hoping this can be a jumping-off point for further discussion, review and revision.

I'm currently making no attempt to validate input. This implementation should do the right thing so long as it's handed reasonable code, but if you pass in something like `(let (:a :b :c) (fn 42))`, all bets are off. In the next few days I'm hoping to make this handle such cases by skipping the special-cased formatting and treating weird inputs like ordinary lists.

I've mostly been referencing [`clojure.pprint`](https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj), although this is by no means a 1:1 port. Is it acceptable for us to diverge a little, or should I make getting the same formatted output as `clojure.pprint` for the same input more of a priority? (FWIW we're already pretty close most of the time, and out-of-the-box `clojure.pprint` is missing a number of special cases that I've included here.)