title: Concatenating multiple lists in Elixir
body: <p>I am learning Elixir and found myself having to concat multiple lists together where I have a beginning, middle, and end.  Simplified example:</p>
  
  <pre><code>a = [1,2]
  b = [3,4]
  c = [5,6]
  a ++ b ++ c
  &gt; [1, 2, 3, 4, 5, 6]
  </code></pre>
  
  <p>I am doing this thousands of times in a stream and want to be Elixirific about it.</p>
  
  <h2>Part 1)</h2>
  
  <p>I wrote a function to handle this, there is probably something that does this for me, but I don't see it.  Should I be using built-in Elixir function for this?</p>
  
  <pre><code>def append(front, back) when is_list(front) when is_list(back) do
    front
    |&gt; Enum.reverse
    |&gt; Enum.reduce(back, &amp;([&amp;1 | &amp;2]))
  end
  </code></pre>
  
  <p>Or should I have just done this and it will become more natural for me over time?</p>
  
  <pre><code>[1, 2]
  |&gt; Enum.reverse 
  |&gt; Enum.reduce([3, 4], &amp;([&amp;1 | &amp;2]))
  |&gt; Enum.reverse
  |&gt; Enum.reduce([5, 6], &amp;([&amp;1 | &amp;2]))
  </code></pre>
  
  <h2>Part 2)</h2>
  
  <p>Does the order in which I call the parts together matter?</p>
  
  <pre><code>Way 1:
  [1, 2]
  |&gt; append([3, 4])
  |&gt; append([5, 6])
  
  ...
  Way 2:
  end = append([3, 4], [5, 6])
  append([1, 2], end)
  </code></pre>
  
  <p>Will the intermediary list be re-used in both scenarios since both are appending header pointers?</p>
  
  <p>Any help on this would be great, cheers.</p>