You're viewing version 1.2.0 of print-method. The latest stable version of Clojure Core is 1.3.0.
1.2.0 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:2804 top

(defmulti print-method (fn [x writer] (type x)))
Vars in clojure.core/print-method: defmulti fn type
Used in 1 other vars defrecord

Comments top

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