Skip to content

Instantly share code, notes, and snippets.

@zmaril
Created July 27, 2011 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmaril/1108533 to your computer and use it in GitHub Desktop.
Save zmaril/1108533 to your computer and use it in GitHub Desktop.
Messing around with authorship triangle in clojure
(defmulti my-print class)
(defmethod my-print clojure.lang.IPersistentVector [c]
(.write *out* "[")
(.write *out* (str-join " " c))
(.write *out* "]"))
(defmethod my-print java.util.Collection [c]
(.write *out* "(")
(.write *out* (str-join " " c))
(.write *out* ")"))
(defmethod my-print java.lang.Iterable [c]
(.write *out* "*")
(.write *out* (str-join " " c))
(.write *out* "*"))
(prefer-method my-print clojure.lang.IPersistentVector java.util.Collection)
(prefer-method my-print java.util.Collection java.lang.Iterable)
(prefer-method my-print java.lang.Iterable clojure.lang.IPersistentVector )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment