Modules
If you're familiar with other languages such as Python, modules aren't really a new concept. They define a set of functions and essentially namespace these functions from others. This avoids name conflicts and introduces a level of plugability and reusability throughout. Elixir modules, similarly, follow suit.
A module in Elixir defines a set of public and private functions that can either be used externally or internally. Modules in Elixir are defined with the defmodule name do block end
construct. In fact, the simplest module we can define is the following:
defmodule Foobar do end
Of course, this is a highly uninteresting module, but we can define it. In fact, we can even define it in our interactive session:
iex>(1) defmodule Foo do end {:module, Foo, <<70, 79, 82, 49, 0, 0, 3, 136, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 60, 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, ...>>, nil...