title: Elixir how to iterate over two lists at once to produce a new list?
body: <p>I'd like to iterate over two lists at once, but can't figure out how. The for loop, which allows you to have multiple lists acts as nested for loops and I'm not that familiar with <code>Enum</code>, but perhaps there's a solution there.</p>
  
  <p>Python has <code>zip(list_1,list_2)</code> and <code>enumerate(list_1)</code> to accomplish this</p>
  
  <p>In Tcl is even easier for me:</p>
  
  <pre><code>% foreach var1 [list 1 3] var2 [list 2 4] {
      puts "$var1 $var2"
    }
  1 2
  3 4
  </code></pre>
  
  <p>But I cannot figure out how to do it in Elixir.</p>
  
  <p>The reason I want to do it is because I have a list of maps like this </p>
  
  <pre><code>[%{"a" =&gt; "1539", "b" =&gt; "300"},
   %{"a" =&gt; "4095", "b" =&gt; "0"},
   %{"a" =&gt; "5371", "b" =&gt; "0"},
   %{"a" =&gt; "7524", "b" =&gt; "0"},
   %{"a" =&gt; "8267", "b" =&gt; "27"}]
  </code></pre>
  
  <p>and I have a list of items of the same size:</p>
  
  <pre><code>["a","b","c","d","e"]
  </code></pre>
  
  <p>and I'd like to run them through a loop together to replace items in the map if and when one of the elements in the map is a certain condition (not 0):</p>
  
  <pre><code>[%{"a" =&gt; "a", "b" =&gt; "300"},   # notice the change in element "a"
   %{"a" =&gt; "4095", "b" =&gt; "0"},
   %{"a" =&gt; "5371", "b" =&gt; "0"},
   %{"a" =&gt; "7524", "b" =&gt; "0"},
   %{"a" =&gt; "e", "b" =&gt; "27"}]    # notice the change in element "a"
  </code></pre>
  
  <p>Anyway. Can someone help me understand enumerable or how to iterate over two lists in elixir?</p>