On Nov 11, 2007 7:18 PM, Yuh-Ruey Chen <[EMAIL PROTECTED]> wrote: > Garrett Smith wrote: > > JavaScript does not provide basic functionality for unique collections. > > > > It's trivial to implement an efficient Set class even in ES3 (with > certain restrictions on the "type" of the key) - just use objects which > are pretty much specialized hash tables (maps from string to values, > keys collides with prototype keys). For ES4, we have maps which are hash > tables as bareboned as you'll get in the language. I'm not sure why you > have all those |!Map.containsKey(lisx[i])| checks in your Map example, > since they're totally unnecessary. > Where is the string value in something like: {a:1}
I wrote an Array-backed sorted set before but ended up not using it. I did not like all the runtime checks and found another way to do what I wanted to do. > A SortedSet is a bit trickier, because that would require some sort of > binary search tree to be efficient. But it can be done. > -- Programming is a collaborative art. _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss