Hello, I'm wondering if there's a way to do array intersections that I haven't found yet.
I've been trying to use Array.without() for this, but it can't compare one Array to another. Is there a way to convert an Array to a list of parameters for a function call (which is what Array.without() is expecting) without resorting to eval() trickery? <html> <head> <script type="text/javascript" src="prototype.js"></script> <script type="text/javascript"> function runTest() { var results = $('results'); var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]; var even = [2, 4, 6, 8]; var odd = numbers.without(even); results.innerHTML += 'numbers: ' + numbers.inspect() + '<br/>'; results.innerHTML += 'even: ' + even.inspect() + '<br/>'; results.innerHTML += 'odd: ' + odd.inspect() + '<br/>'; } </script> </head> <body> <div id="results"></div> <button onclick="runTest()">Run Test</button> </body> </html> I can get the behavior I want if I override Array.without() like: Array.prototype.without = function() { var values = $A(arguments).flatten(); return this.select(function(value) { return !values.include(value); }); } but, I'd really prefer not to have to do that. Thanks, Todd _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs