I have a Java class Vector2that I would like to convince to "play perfectly" with a Clojure reader.
(def a (vec2 1 2))
(print-str a)
=> "#<Vector2 [1 2]>"
Ideally, I would like the class to print in a form that is read by a Clojure reader. that is, I would like the following to return correctly:
(= a (read-string (print-str a)))
What is the best way to achieve this round trip capability?
source
share