Skip to content

Instantly share code, notes, and snippets.

@hiredman
Created October 13, 2009 20:06
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 hiredman/209514 to your computer and use it in GitHub Desktop.
Save hiredman/209514 to your computer and use it in GitHub Desktop.
(defmulti make-a (fn [& xs] (vec (cons (first xs) (map type (rest xs))))))
(defmulti invoke-on (fn [obj name & xs]
(vec (cons (type obj) (cons name (map type xs))))))
(defmethod make-a [::Object] [_]
(with-meta {} {:type ::Object}))
(defmethod invoke-on [::Object :to_s] [_ _]
"OBJECT_STRING")
(derive ::String ::Object)
;etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment