Elixir Metaprogramming Cheat Sheet

From WikiOD

Here is the cheatsheat of Elixir Metaprogramming and basic guide on how to use Elixir Metaprogramming

Kernel[edit | edit source]

Most of these magic is defined in Kernel.SpecialForms.

Pseudo-variables[edit | edit source]

__DIR__     # current dir
__MODULE__  # current module
__CALLER__  # caller of the function

__ENV__[edit | edit source]

[:__struct__, :aliases, :context, :context_modules, :export_vars, :file,
 :function, :functions, :lexical_tracker, :line, :macro_aliases, :macros,
 :module, :requires, :vars]
__CALLER__.module |> Module.definitions_in |> IO.inspect
apply(Enum, :reverse, [[1, 2, 3]])