Loading a mix project

    mix -S iex

That should load all the modules in lib/.

Once a shell is open, changes can be reoladed with the recompile() command.

Modules

Modules and files

can a file contain several modules?

A file's path, subdirectories, have NOTHING to do with the module defined in that file, the name of that module, etc.

But it is usual/common practice to have modules match the path structure.

External modules

All external dependencies live in deps/; their source code is there.

If you need to change some part of them (e.g., change their code and test the changes in your project), you can go ahead and do so, and then do the following so mix/elixir notices the changes:

In your mix.exs file, adjust the list of dependencies, to tell elixir that your dependency should be loaded from a given path: ``` // mix.exs

... defp deps() do [ ... {:my_lib, path: "deps/my_lib"}, ... ] end ... `` And then restart iex. **NOTE** therecompile` helper does not notice changes in your dependencies, you must restart iex.

See http://blog.plataformatec.com.br/2016/03/inspecting-changing-and-debugging-elixir-project-dependencies/

Concurrency

Concurrency

Parallel map: :rpc.pmap: it uses one process per element.

Misc

Testing

Tests must finish with _test.exs for mix test to find them.

Integer arithmetic

Integer division: Kernel.div

Integer remainder, a.k.a. modulo: Kernel.rem

Profiling

import ExProf.Macro
profile do
  ...
end