Elixirの関数の引数にはmoduleを渡すことができる。
defmodule Test do
def exec(m) do
m.puts("hello")
end
end
Test.exec(IO) #=> hello
実演
調べても、関数の引数におけるmoduleの扱いについてはあまり言及されていなかったのでメモ。
More than 5 years have passed since last update.
Elixirの関数の引数にはmoduleを渡すことができる。
defmodule Test do
def exec(m) do
m.puts("hello")
end
end
Test.exec(IO) #=> hello
実演
調べても、関数の引数におけるmoduleの扱いについてはあまり言及されていなかったのでメモ。
Register as a new user and use Qiita more conveniently