Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created August 14, 2013 03:45
Show Gist options
  • Save pragdave/6227836 to your computer and use it in GitHub Desktop.
Save pragdave/6227836 to your computer and use it in GitHub Desktop.
defmodule Macros do
defmacro test(do: body) do
quote hygiene: [vars: false] do
def meth(a,b), do: unquote(body)
end
end
end
defmodule UseMacro do
import Macros
test do
IO.inspect [a,b]
end
end
UseMacro.meth(1,2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment