Skip to content

Instantly share code, notes, and snippets.

@alco
Last active August 29, 2015 14:08
Show Gist options
  • Save alco/3eeab282eb9ad3e4245d to your computer and use it in GitHub Desktop.
Save alco/3eeab282eb9ad3e4245d to your computer and use it in GitHub Desktop.
defmodule Returning do
defmacro returning(val, do_block) do
quote do
val = unquote(val)
case val, unquote(do_block)
val
end
end
end
# this won't work
defmodule Returning do
defmacro returning(val, do_block) do
quote bind_quoted: [val: val, do_block: do_block] do
case val, do_block
val
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment