title: Elixir: accessing a list of tuples from query_param and iterating over it
body: <p>I'm getting input via a query param like this: <code>127.0.0.1:8000/pair?A=[{A1,B1},{A2,B2},…,{An,Bn}]</code>. I need to access that list of tuples and alter it, so that the result is a list of two tuples, the first one contains the first elements of each tuple in the original list, and the second tuple contains the second elements of each tuple, (like this <code>[{A1,A2,…,An},{B1,B2,…,Bn}]</code>) for example:</p>
  <pre><code>Input: [{a,5},{2,x},{r,r}]
  
  Output: [{a,2,r},{5,x,r}]
  </code></pre>
  <p>The problem is that if I do:</p>
  <pre><code>conn = fetch_query_params(conn)
  %{ &quot;A&quot; =&gt; input } = conn.query_params
  </code></pre>
  <p>the input variable is then bitstring, so I tried using
  <code>input_parsed = :binary.bin_to_list input</code>, but then if I'm trying to iterate over it like this:</p>
  <pre><code>output = Enum.map(input_parsed, fn {x, y} -&gt; {x+y} end)
  </code></pre>
  <p>I'm getting the following errors:</p>
  <pre><code>(FunctionClauseError) no function clause matching in anonymous fn/1 in PwZadanie1.Router.do_match/4
          (pw_zadanie_1 0.1.0) lib/pw_zadanie1/router.ex:30: anonymous fn(91) in PwZadanie1.Router.do_match/4
          (elixir 1.11.3) lib/enum.ex:1411: Enum.&quot;-map/2-lists^map/1-0-&quot;/2
  </code></pre>
  <p>91 is <code>[</code> in ASCII so it's still not parsed.</p>
  <p>I'm new to Elixir and would greatly appreciate any help with this. Thank you.</p>