Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
defmodule MyReceive do
defmacro my_receive(do: clauses) do
extra = quote do
other -> IO.puts "got #{inspect other}"
end
quote do
receive do: unquote(clauses ++ extra)
end
end
end
defmodule Sample do
import MyReceive
send self, :world
my_receive do
:hello -> IO.puts "hello"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.