Last active
August 29, 2015 14:05
-
-
Save alco/cfcd38b6b930192d14a3 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
vars = ... | |
ignored_vars = ... | |
quote bind_quoted: [name: name, body: Macro.escape(body)] do | |
name = String.to_atom(name) | |
# This unquote is deferred for later, but unquote_splicing needs to be run | |
def unquote(name)(0, result, unquote_splicing(ignored_vars)) do | |
result | |
end | |
# Same here | |
def unquote(name)(n, _, unquote_splicing(vars)) do | |
unquote(name)(n-1, unquote(body), unquote_splicing(vars)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment