1.3.0 permalink Arrow_down_16x16

print-method

clojure.core

1 Example top

  • (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->>
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3253 top

(defmulti print-method (fn [x writer]
                         (let [t (get (meta x) :type)]
                           (if (keyword? t) t (class x)))))
Vars in clojure.core/print-method:
Used in 0 other vars

Comments top

No comments for print-method. Log in to add a comment.