Last active
August 29, 2015 14:09
-
-
Save mishok13/d66156a6bf45f83c7247 to your computer and use it in GitHub Desktop.
Banging my head, how to make this macro behave the same way regardless of what is passed?
This file contains hidden or 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
user> (require '[plumbing.core :refer [fnk]]) | |
nil | |
user> (defmacro fnk-creator | |
[args] | |
`(fnk [~@(map symbol (:params args))] [~@(map symbol (:params args))])) | |
#'user/fnk-creator | |
user> (def x {:params ["foo"]}) | |
#'user/x | |
user> (macroexpand-1 '(fnk-creator x)) | |
(plumbing.core/fnk [] []) | |
user> (macroexpand-1 '(fnk-creator {:params ["foo"]})) | |
(plumbing.core/fnk [foo] [foo]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment