(deftype XYZ []) ; without custom print-method defined: user=> (prn (XYZ.)) #<XYZ user.XYZ@2670d85b> (defmethod print-method XYZ [v ^java.io.Writer w] (.write w "<<-XYZ->>")) ; with print-method user=> (prn (XYZ.)) <<-XYZ->>
(deftype XYZ []) ; without custom print-method defined: user=> (prn (XYZ.)) #<XYZ user.XYZ@2670d85b> (defmethod print-method XYZ [v ^java.io.Writer w] (.write w "<<-XYZ->>")) ; with print-method user=> (prn (XYZ.)) <<-XYZ->>
(defmulti print-method (fn [x writer]
(let [t (get (meta x) :type)]
(if (keyword? t) t (class x)))))
Comments top
No comments for print-method. Log in to add a comment.