Public Vars

Back

print-method (clj)

(source)

multimethod

Examples

nervous-systems/sputter
(ns sputter.util.repl
  (:require [sputter.util            :as util]
            [sputter.word            :as word]
            [sputter.state.memory    :as mem]
            [clojure.core.rrb-vector :as rrb])
  (:import [java.math        BigInteger]
           [io.nervous.juint UInt256]))

(defmethod print-method BigInteger [word w]
  (.write w (util/bytes->hex word {:pad-left word/size})))

(defmethod print-method UInt256 [word w]
  (.write w (util/bytes->hex word {:pad-left word/size})))

;; (defmethod print-method (type (rrb/vector)) [mem w]
;;   (let [words (mem/stored mem)]
;;     (doseq [i (range words)
;;             :let [[_ v] (mem/recall mem (* i word/size) word/size)]]
;;       (.write w (util/bytes->hex (* i word/size) {:pad-left 2}))
;;       (.write w " ")
;;       (.write w (pr-str (word/->Word v)))
;;       (.write w "\n"))))
nedap/speced.def
(ns nedap.speced.def.impl.def-with-doc
  (:require
   [clojure.core.protocols]
   #?(:cljs [cljs.repl])
   #?(:clj [clojure.spec.alpha :as spec] :cljs [cljs.spec.alpha :as spec])
   [nedap.utils.spec.api :refer [check!]])
  #?(:cljs (:require-macros [nedap.speced.def.impl.def-with-doc]))
  #?(:clj (:import (java.io Writer))))

#?(:clj
   (defmethod print-method Docstring
     [this ^Writer writer]
     (let [^String docstring (-> this :docstring)]
       (-> writer (.write docstring)))))
dco-dev/interval-tree
(ns com.dean.interval-tree.tree.ordered-map
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.protocol :as proto]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.tree     :as tree]
            [com.dean.interval-tree.tree.order    :as order])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection]))

(defmethod print-method OrderedMap [m w]
  ((get (methods print-method) clojure.lang.IPersistentMap) m w))
dco-dev/interval-tree
(ns com.dean.interval-tree.tree.interval-map
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [com.dean.interval-tree.tree.interval :as interval]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.order    :as order]
            [com.dean.interval-tree.tree.tree     :as tree])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection
                                         IIntervalCollection]))

(defmethod print-method IntervalMap [m w]
  ((get (methods print-method) clojure.lang.IPersistentMap) m w))
dco-dev/interval-tree
(ns com.dean.interval-tree.tree.interval-set
  (:require [clojure.core.reducers       :as r :refer [coll-fold]]
            [clojure.set]
            [com.dean.interval-tree.tree.interval :as interval]
            [com.dean.interval-tree.tree.node     :as node]
            [com.dean.interval-tree.tree.order    :as order]
            [com.dean.interval-tree.tree.protocol :as proto]
            [com.dean.interval-tree.tree.root]
            [com.dean.interval-tree.tree.tree     :as tree])
  (:import  [clojure.lang                RT]
            [com.dean.interval_tree.tree.protocol PExtensibleSet]
            [com.dean.interval_tree.tree.root     INodeCollection
                                         IBalancedCollection
                                         IOrderedCollection
                                         IIntervalCollection]))

(defmethod print-method IntervalSet [s w]
  ((get (methods print-method) clojure.lang.IPersistentSet) s w))