title: Is a list comprehension or a sequential filter more optimized?
body: <p>Let's say you have to return the sum of all the multiples of 2 and 3 in a set of integers from 1-100. In Haskell, the code I would write would look something like this:</p>
  
  <pre><code>sum ([x*2 | x&lt;-[1..100], x*2 &lt; 100] `union` [x*3 | x&lt;-[1..100], x*3 &lt; 100])
  </code></pre>
  
  <p>This uses 2 list comprehensions with a union. Another solution would be to step through each item in the list and evaluate it (using a modulus), then add it to a separate list, which you would later add together.</p>
  
  <p>Both of these solutions come out with the same answer, but which one is more optimized if you had to do the same for, say, a list from 1..1000000?</p>
  
  <p>The answer to the original question is 3317 if you want to create your own algorithm.</p>