Add intersections and unions to Set
medikoo+mozilla.org at medikoo.com
Tue Apr 2 02:22:36 PDT 2013
Additionally I propose to give more JS friendly method names:
Intersection as `and`:
set1and2 = set1.and(set2);
Union as `or`:
set1or2 = set1.or(set2);
Complement as `not`:
set1butNot2 = set1.not(set2);
Peter Michaux wrote:
> On Mon, Mar 4, 2013 at 10:56 AM, Tab Atkins Jr. <jackalmage at gmail.com>
>> On Mon, Mar 4, 2013 at 10:08 AM, <aleth at instantbird.org> wrote:
>>> It would be useful to be able to form the intersection and the union of
>>> two Sets. These are natural operations that are currently not part of
>>> the API
>>> Similar methods would make sense for Map, but one would have to think
>>> about what to do in the case where the key but not the value matches.
>>> An intersection is equivalent to a particular filter, so an alternative
>>> might be to add a method like Array.filter to Sets instead.
>>> (I filed bug 847355 for this and was told this mailing list was the
>>> right place for this suggestion.)
>> Yes please, and also minus (remove from set A all elements it shares
>> with set B). All three of these are fairly vital for a lot of code
>> using sets.
> I agree that these methods would be useful. They are common set
> operations and they do seem missing from the Set draft spec.
> es-discuss mailing list
> es-discuss at mozilla.org
View this message in context: http://old.nabble.com/Add-intersections-and-unions-to-Set-tp35134737p35243086.html
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at Nabble.com.
More information about the es-discuss