Skip to content

Instantly share code, notes, and snippets.

@alco
Created June 5, 2014 10:08
Show Gist options
  • Save alco/0c92c437dac30ff5395a to your computer and use it in GitHub Desktop.
Save alco/0c92c437dac30ff5395a to your computer and use it in GitHub Desktop.
iex(3)> defmodule D do
...(3)> defpool ping(pid, arg1, arg2) when is_pid(pid), do: IO.inspect pid
...(3)> end
[name: :ping]
[args: [{:pid, [line: 4], nil}, {:arg1, [line: 4], nil},
{:arg2, [line: 4], nil}]]
[other_args: [{:arg1, [line: 4], nil}, {:arg2, [line: 4], nil}]]
[guards: [{:is_pid, [line: 4], [{:pid, [line: 4], nil}]}]]
[block: {{:., [line: 4],
[{:__aliases__, [counter: 0, line: 4], [:IO]}, :inspect]}, [line: 4],
[{:pid, [line: 4], nil}]}]
iex:4: warning: variable arg1 is unused
iex:4: warning: variable arg2 is unused
{:module, D,
<<70, 79, 82, 49, 0, 0, 5, 196, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 210, 131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115, 95, 118, 49, 108, 0, 0, 0, 2, 104, 2, 100, 0, 4, ...>>,
{:ping, 2}}
iex(4)> D.ping(self, :hello, :world)
#PID<0.45.0>
#PID<0.45.0>
iex(5)> D.ping(1, :hello, :world)
1
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment