Skip to content

Instantly share code, notes, and snippets.

@zmaril
Created July 27, 2011 02:14
Show Gist options
  • 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