Re: Additional Set.prototype methods

2013-12-31 Thread Brendan Eich
Mark S. Miller wrote: Sets and Maps are deterministically ordered by insertion order. I know; my point was whether this should be reduce order (and reduceRight the reverse?). /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozil

Re: Additional Set.prototype methods

2013-12-31 Thread David Bruant
Le 31/12/2013 20:52, Calvin Metcalf a écrit : I had the same idea a couple weeks ago and turned it into a library https://github.com/calvinmetcalf/set.up if anyone finds it useful. hmm... It is useful, but not future-proof. If methods with these names ever get standardized, your code will overri

Re: Additional Set.prototype methods

2013-12-31 Thread David Bruant
Le 01/01/2014 00:34, Brandon Benvie a écrit : How about Maps? Sets and arrays are very much alike in that they are collections of items. Maps are more like objects. I'd expect maps to have methods like the one we apply on object (Object.keys, etc.), but I think everything is covered. I guess

Re: Additional Set.prototype methods

2013-12-31 Thread Mark Miller
https://wiki.mozilla.org/User:Jorend/Deterministic_hash_tables On Tue, Dec 31, 2013 at 5:06 PM, Forrest L Norvell wrote: > On Tue, Dec 31, 2013 at 2:45 PM, Mark S. Miller wrote: > >> Sets and Maps are deterministically ordered by insertion order. >> > > I understand how the need to specify a det

Re: Additional Set.prototype methods

2013-12-31 Thread Forrest L Norvell
On Tue, Dec 31, 2013 at 2:45 PM, Mark S. Miller wrote: > Sets and Maps are deterministically ordered by insertion order. > I understand how the need to specify a deterministic traversal order for for-of led to this result, but doesn't that preclude a number of (potentially faster with larger col

Re: Additional Set.prototype methods

2013-12-31 Thread Brandon Benvie
How about Maps? And since their order is deterministic, how about the rest of the array extras? > On Dec 31, 2013, at 11:36 AM, David Bruant wrote: > > Hi, > > I've been playing with Sets recently and believe that the following additions > would make them more useful by default: > * Set.proto

Re: Additional Set.prototype methods

2013-12-31 Thread Allen Wirfs-Brock
On Dec 31, 2013, at 2:38 PM, Rick Waldron wrote: > > > > On Tue, Dec 31, 2013 at 5:30 PM, Allen Wirfs-Brock > wrote: > > On Dec 31, 2013, at 1:53 PM, Brendan Eich wrote: > >> David Bruant wrote: >> >> ... >> >> >>> I haven't had a use for a .reduce yet, but maybe that would make sense t

Re: Additional Set.prototype methods

2013-12-31 Thread Mark S. Miller
Sets and Maps are deterministically ordered by insertion order. On Tue, Dec 31, 2013 at 1:53 PM, Brendan Eich wrote: > David Bruant wrote: > >> Hi, >> >> I've been playing with Sets recently and believe that the following >> additions would make them more useful by default: >> * Set.prototype.m

Re: Additional Set.prototype methods

2013-12-31 Thread Rick Waldron
On Tue, Dec 31, 2013 at 5:30 PM, Allen Wirfs-Brock wrote: > > On Dec 31, 2013, at 1:53 PM, Brendan Eich wrote: > > David Bruant wrote: > > ... > > > I haven't had a use for a .reduce yet, but maybe that would make sense too? > > > Are Sets ordered just because for-of says so? :-P > > > Actually, a

Re: Additional Set.prototype methods

2013-12-31 Thread Allen Wirfs-Brock
On Dec 31, 2013, at 1:53 PM, Brendan Eich wrote: > David Bruant wrote: > > ... > >> I haven't had a use for a .reduce yet, but maybe that would make sense too? > > Are Sets ordered just because for-of says so? :-P Actually, according to the spec. they are ordered, but this is only currently

Re: Additional Set.prototype methods

2013-12-31 Thread Brendan Eich
David Bruant 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 exi

Re: Additional Set.prototype methods

2013-12-31 Thread Calvin Metcalf
I had the same idea a couple weeks ago and turned it into a library https://github.com/calvinmetcalf/set.up if anyone finds it useful. It adds all the array methods that make sense, ie reduce but not reduceRight On Tue, Dec 31, 2013 at 2:36 PM, David Bruant wrote: > Hi, > > I've been playing w

Additional Set.prototype methods

2013-12-31 Thread David Bruant
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