Where is a good mathematical sets implementation for JavaScript? It should include efficient implementations of intersection, union, complement, and (for bonus points) the Carte
In the program that sparked this question, a set is an Array and intersect is
s = [1,2,3]; q = [3,4,5]; sq = s.filter(function(x) { return q.indexOf(x) >= 0; });
Of course it doesn't work in ie.