Created
March 2, 2010 11:15
-
-
Save myfit/319438 to your computer and use it in GitHub Desktop.
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
(defn call-method [method params] | |
...POST request...) | |
(defn apify-method [call-sym] | |
(let [call (name call-sym) | |
call-sp (.split call "-") | |
class (first call-sp) | |
method1 (first (rest call-sp)) | |
method (if (< 1 (count call-sp)) | |
(rest (rest call-sp)) ())] | |
(format | |
"%s.%s%s" | |
class | |
method1 | |
(string/join "" | |
(map string/capitalize method))))) | |
(defmacro define-method [method args] | |
`(defn ~method ~args | |
(call-method ~(format "facebook.%s" (apify-method method)) | |
~(zipmap | |
(map | |
#(keyword (name %)) | |
args) | |
args)))) | |
(define-method my-complex-method [my_arg_name]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment