Skip to content

Instantly share code, notes, and snippets.

@cgrand
Created June 10, 2010 09:23
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 cgrand/432752 to your computer and use it in GitHub Desktop.
Save cgrand/432752 to your computer and use it in GitHub Desktop.
(defmacro defmethodfn
"Creates and installs a new method of multimethod associated with dispatch-value. "
[multifn dispatch-val f]
`(. ~(with-meta multifn {:tag 'clojure.lang.MultiFn}) addMethod ~dispatch-val ~f))
(defmethodfn my-multi :my-type (snippet "my/resource.html" [:#id] [arg] ...))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment