Skip to content

Instantly share code, notes, and snippets.

@mzemel
Last active October 22, 2015 16:32
Show Gist options
  • Save mzemel/b63401499e3787125ac8 to your computer and use it in GitHub Desktop.
Save mzemel/b63401499e3787125ac8 to your computer and use it in GitHub Desktop.
defmodule Tracer do
defmacro def(definition, do: expression) do
{name, _, args} = definition
quote do
Kernel.def(unquote(definition)) do
IO.puts "==> call: #{unquote(name)} (#{unquote(args)})"
result = unquote(content)
IO.puts "<== result: #{result}"
result
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment