title: How can I return a list in Elixir?
body: <p>I am working through Programming Elixir book and playing with exercises.  I have a sum function where I would like to return sum value in a list <code>[]</code> instead of just a number but I get <code>bad argument in arithmetic expression</code>.  Could do with some directions?</p>
  
  <pre><code>defmodule Mymod do
    def sum([]), do: []
    def sum([head | tail]) do
      [head  + sum(tail)]
    end
  end
  </code></pre>