Skip to content

Instantly share code, notes, and snippets.

@cgrand
Created April 28, 2010 08:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cgrand/19367943286f495c96df to your computer and use it in GitHub Desktop.
;; alternative designs:
;; * everything outside defplugin
(defplugin
(cmdkey [args]
body...)
(cmdkey [args]
body...)
(cmdkey [args]
body...))
;; The core of this defplugin would then be
;; (you still need to flesh it out with your load/unload mechanism)
(defmacro defplugin [& body]
`(do
~@(for [[cmdkey & method-stuff] body]
`(defmethod respond ~cmdkey ~@method-stuff))))
;; * interleaved
(defplugin
some init code
; a top-level map denot a set of commands
{cmdkey ([args]
body...)
cmdkey ([args]
body...)
cmdkey ([args]
body...)}
something else
;; more commands
{cmdkey ([args]
body...)
cmdkey ([args]
body...)}
cmdkey ([args]
body...)}
other stuff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment