Created
November 12, 2013 12:42
-
-
Save Andy-Richards/7430199 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
defmodule MyMacro do | |
defmacro do_something(query) do | |
quote do | |
args = String.split(unquote(query)) | |
fun = fn(arg) -> IO.inspect var!(unquote(binary_to_atom(arg))) end | |
Enum.each args, fun | |
end | |
end | |
end | |
defmodule Test do | |
require MyMacro | |
wibble = 123 | |
wobble = abc | |
MyMacro.do_something("wibble wobble") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment