title: Union of two sets in Scala
body: <p>From the question linked <a href="https://stackoverflow.com/questions/6963792/scala-functional-set-problem">here</a>, I found this implementation of Union in Scala:</p>
  
  <pre><code>def union(a: Set, b: Set): Set = i =&gt; a(i) || b(i)
  </code></pre>
  
  <p>And Set is a function of type:</p>
  
  <pre><code>type Set = Int =&gt; Boolean
  </code></pre>
  
  <p>Now I understand that in Scala, a function is mapped from Int to Boolean here, and I further understand how this statement is executed:</p>
  
  <pre><code>a(i) || b(i)
  </code></pre>
  
  <p>But what I don't understand is what is 'i' here. Where does it come from? And when it finds a match between to sets, it returns true, if it indeed does, where do I filter it?</p>