title: How to get distinct items from a Scala Iterable, maintaining laziness
body: <p>I have a <code>java.lang.Iterable</code> which computes its values lazily. I am accessing it from Scala. Is there a core API way of returning only distinct values? For instance, imaging there was a filter method that also provided all results returned thus far:</p>
  
  <pre><code>val myLazyDistinctIterable = iterable.filter((previousReturnedItems, newItem) =&gt; previousReturnedItems.contains(newItem))
  </code></pre>
  
  <p>I guess this is not a very general case because it involves storing previously returned items, and that might be why it isn't in the core API.</p>
  
  <p>I know about <code>List.distinct</code> and <code>Set</code>s but I want something that will not compute its elements until asked.</p>