Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created September 26, 2020 04:52
Show Gist options
  • Save krainboltgreene/8b4ea24efd7f690ce6f03d72bf3a3105 to your computer and use it in GitHub Desktop.
Save krainboltgreene/8b4ea24efd7f690ce6f03d72bf3a3105 to your computer and use it in GitHub Desktop.
defmodule Example do
defmacro example(block) do
quote do
def test(unquote(block)) do
IO.inspect(a)
end
end
end
end
defmodule Elpmaxe do
import Example
example(quote do
%{a: a}
end)
end
Elpmaxe.test(%{a: 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment