title: Unique array comprehension
body: <p>I have the following array in CoffeeScript:</p>
  
  <pre><code>electric_mayhem = [ { name: "Doctor Teeth", instrument: "piano" },
                  { name: "Janice", instrument: "piano" },
                  { name: "Sgt. Floyd Pepper", instrument: "bass" },
                  { name: "Zoot", instrument: "sax" },
                  { name: "Lips", instrument: "bass" },
                  { name: "Animal", instrument: "drums" } ]
  </code></pre>
  
  <p>My goal is to get all instrument names from this array. </p>
  
  <p>Expected result: <code>['piano', 'bass', 'sax', 'drums']</code></p>
  
  <p>My first solution based on <a href="http://coffeescriptcookbook.com/chapters/arrays/removing-duplicate-elements-from-arrays" rel="nofollow">this</a>:</p>
  
  <pre><code>names = (muppet.instrument for muppet in electric_mayhem)
  output = {}
  output[name] = name for name in names
  names = (value for key, value of output)
  </code></pre>
  
  <p>This is rather long. I looket at the transpiled javascript, and saw the first line is translated to:</p>
  
  <pre><code>names = (function() {
    var _i, _len, _results;
    _results = [];
    for (_i = 0, _len = electric_mayhem.length; _i &lt; _len; _i++) {
      muppet = electric_mayhem[_i];
      _results.push(muppet.instrument);
    }
    return _results;
  })();
  </code></pre>
  
  <p>So I made up a super-hacky solution that uses the <code>_results</code> variable introduced during transpilation:</p>
  
  <pre><code>names = (muppet.instrument for muppet in electric_mayhem \
    when muppet.instrument not in _results)
  </code></pre>
  
  <p>It works, but I don't like it relies on not documented variable name so it may break with future releases of CoffeeScript.</p>
  
  <p>Is there any one-liner to achieve "unique comprehension" in a non-hacky way?</p>