title: Elixir - Convert List into a Map
body: <p>What would be an elegant, efficient way for converting a list like <code>[1,2,3,4]</code> into the map  <code>%{1=&gt;2, 3=&gt;4}</code>? I wrote this:</p>
  
  <pre><code>     Enum.reduce([1,2,3,4],%{}, fn(item, acc) -&gt;
          case Map.get(acc, :last) do
            nil -&gt;
              Map.put(acc, :last, item)
            last -&gt;
              acc = Map.put(acc, item, last)
              Map.drop(acc, [:last])
          end
        end)
  </code></pre>
  
  <p>But this does not seem very elegant. Is there a more elegant and cleaner way of doing this?</p>