Tutorial by Examples

The __info__/1 function takes one of the following atoms: :functions - Returns a keyword list of public functions along with their arities :macros - Returns a keyword list of public macros along with their arities To list the Kernel module’s functions: iex> Kernel.__info__ :functions [...
Modules have four associated keywords to make using them in other modules: alias, import, use, and require. alias will register a module under a different (usually shorter) name: defmodule MyModule do # Will make this module available as `CoolFunctions` alias MyOtherModule.CoolFunctions #...
Use defdelegate to define functions that delegate to functions of the same name defined in another module: defmodule Math do defdelegate pi, to: :math end iex> Math.pi 3.141592653589793

Page 1 of 1