Sum a list with Elixir

defmodule M do def sum([h | t]) do h + sum(t) end def sum([]) do 0 endend

Then, when we pass list to function sum of module M we get

sum

M

M.sum([1, 2, 3, 4, 5])15