Skip to content

Instantly share code, notes, and snippets.

@dbushenko
Created June 3, 2011 12:34
Show Gist options
  • Save dbushenko/1006270 to your computer and use it in GitHub Desktop.
Save dbushenko/1006270 to your computer and use it in GitHub Desktop.
defaction
(defmacro defaction [name & params-with-body]
(let [params-vector (first params-with-body)
params-hash (apply hash-map (flatten (map (fn [p] [p (symbol (str ":" p))]) params-vector)))
body (next params-with-body)
session (symbol "session")]
`(defn ~name [{~params-hash :params, ~session :session}]
~@body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment