 
   clojure.lang.IObj
 
-  (withMeta [_ m]
-    (Multihash. code digest m)))
+  (withMeta [_ meta-map]
+    (Multihash. _code _digest meta-map)))
+
+
+(defmethod print-method Multihash
+  [v ^java.io.Writer w]
+  (.write w (str v)))
 
 
 

  (compareTo [this that]
    (cond
      (= this that) 0
      (< code (.code that)) -1
      (> code (.code that)) 1
      :else (compare digest (.digest that))))


  clojure.lang.ILookup

  (valAt [this k not-found]
    (case k
      :code code
      :algorithm (:name (get-algorithm code))
      :length (/ (count digest) 2)
      :digest (hex/decode digest)
      not-found))

  (valAt [this k]

;;   application-specific algorithm code.
;; - `:digest` is a string holding the hex-encoded algorithm output.
(deftype Multihash
  [^long _code ^String _digest _meta]

  Object

  (toString [this]
    (str "hash:" (name (:name (get-algorithm _code))) \: _digest))

  (equals [this that]
    (cond
      (identical? this that) true
      (instance? Multihash that)
        (and (= _code   (._code   ^Multihash that))
             (= _digest (._digest ^Multihash that)))
      :else false))

  (hashCode [this]
    (hash-combine _code _digest))


  Comparable
