Created
March 19, 2014 20:36
-
-
Save alco/9650625 to your computer and use it in GitHub Desktop.
This file contains 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 M do | |
defp cases do | |
[quote do 0 -> 0 end] | |
++ [quote do 1 -> 2 end, quote do 3 -> 4 end] |> :lists.flatten | |
end | |
defmacrop make_case do | |
IO.inspect cases | |
q = quote do | |
case var!(x) do | |
unquote(cases) | |
end |> IO.inspect | |
end | |
q |> Macro.to_string |> IO.puts | |
q | |
end | |
def test(x) do | |
make_case | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment