title: How to map and reduce List of Maps in Elixir
body: <p>What's a good way to map and reduce the elixir's list and convert it into new list.</p>
  
  <p>Requirement: 
  1. Find the maps with same id: 
  2. Merge the values of "role" key (i.e. Gather all the unique values).
  3. For all other maps(elements of list), do nothing.</p>
  
  <pre><code>list = [%{"id": 1, "role": ["A", "B"]}, %{"id": 2, "role": ["B", "C"]}, %{"id": 1, "role": ["C", "A"]} ]
  </code></pre>
  
  <p>needs to be converted in the following list:</p>
  
  <pre><code>ans_list = [%{"id": 1, "role": ["A", "B", "C"]}, %{"id": 2, "role": ["B", "C"]}]
  </code></pre>