mentat-collective / emmy

The Emmy Computer Algebra System.
https://emmy.mentat.org
GNU General Public License v3.0
405 stars 24 forks source link

Add pretty-print extensions for custom types #153

Open sritchie opened 1 year ago

sritchie commented 1 year ago

Our types aren't caught by clojure.pprint now. We can fix this with an implementation like this example from Gen.clj:

(require '[clojure.pprint :as pprint])
(defmethod pprint/simple-dispatch Choice [^Choice c]
  #?(:clj (.write ^java.io.Writer *out* "#gen/choice ")
     :cljs (-write *out* "#gen/choice "))
  (pprint/simple-dispatch (.-v c)))