Rendering a payroll template
I like the simplicity of just using unquote at the module level to generate the defs, such as:


defmodule MyModule do
  def do_map_stuff(method, arg) do
    IO.inspect([method, arg])
  end

  Enum.each [:method1, :method2, :method3], fn method -&gt;
    def unquote(method)(map) when is_map(map) do
    do_map_stuff(unquote(method), map)
  end

    def unquote(method)(arg)  do
    do_map_stuff(unquote(method), arg)
    end
  end
end