Created
February 11, 2015 01:43
-
-
Save MonkeyIsNull/8e96bf7bf52f237a1291 to your computer and use it in GitHub Desktop.
Presenter
This file contains hidden or 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 Preso do | |
# shows what was passed in and then evals it and shoves the | |
# lhs back into the current context | |
defmacro show(stuff) do | |
{op, _, [{lhs,_, _}, rhs]} = stuff | |
IO.write "#{IO.ANSI.blue}#{IO.ANSI.bright}" | |
IO.write "#{lhs} #{op} " | |
IO.inspect rhs | |
IO.puts "#{IO.ANSI.reset}" | |
quote do | |
# export it back to the callers context | |
var!(ret) = unquote(stuff) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment