I always envisioned that we would create a full fledged iter module and then we would define these functions once and for all. On Jan 8, 2014 6:32 PM, "Calvin Metcalf" <[email protected]> wrote:
> specific to set (as opposed to ones that work with array) would be the > mathematical set operations like union, symmetrical difference (think xor), > compliment, and intersection. > > > On Fri, Jan 3, 2014 at 12:52 PM, Tab Atkins Jr. <[email protected]>wrote: > >> On Tue, Dec 31, 2013 at 11:36 AM, David Bruant <[email protected]> >> wrote: >> > Hi, >> > >> > I've been playing with Sets recently and believe that the following >> > additions would make them more useful by default: >> > * Set.prototype.map >> > * Set.prototype.filter >> > * Set.prototype.toJSON = function(){ >> > return [...this]; >> > }; >> > >> > The 2 first are to easily create sets from existing sets very much like >> what >> > we already have with arrays. I haven't had a use for a .reduce yet, but >> > maybe that would make sense too? >> > The toJSON is just to provide a good default. Obviously anyone >> disatisfied >> > with it can shadow it on specific instances. But this serialization >> makes >> > more sense by default than the one you get now (own properties of the >> set >> > object... which have none in common usages?) >> >> I agree with adding more of the array primitives to sets - sets are >> just an "weakly ordered" version of arrays, so basically all of them >> make sense. >> >> map() is the only troublesome one, because it can produce a smaller >> set, if you return the same value from multiple iterations. This >> isn't necessarily bad, but it's surprising. >> >> ~TJ >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> > > > > -- > -Calvin W. Metcalf > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

