Created
June 3, 2011 12:34
-
-
Save dbushenko/1006270 to your computer and use it in GitHub Desktop.
defaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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