I'm working my way through an intro to Clojure book, and I just got to the section on protocols. I might be missing something/committing a category error, but I'm wondering if there's a way to change the way a protocol is represented in the repl, akin to redefining `__repr__`/`__str__` in Python. The example protocol in the book involves a matrix (i.e., a vector of vectors). I can do this
(extend-protocol Matrix
clojure.lang.IPersistentVector
...
(pprint [vov] (clojure.pprint/pprint vov)))
which works fine when I call (pprint m) on a Matrix m:
(pprint m)
; [[0 0 0]
[0 0 0]
[0 0 0]]
What I'd like is to just have the same behavior "calling" the variable from the repl, i.e.
m
; [[0 0 0]
[0 0 0]
[0 0 0]]
Can/should this be done? Is this a job for macros? Am I just being lazy/un-Clojuric and just get over it and use (pprint m)?