> Sets are not a linear data structure, so the order of entries in a Set is > irrelevant, unlike an Array whose elements must have an explicit position. > Set entries in JS have an iteration order purely to match programmer > intuition (and ensure that all implementations adhere), however there is no > structural importance of the order.
You can impose an order on the elements of a set, though. For example, Java’s `SortedSet` [1] has the methods `first()` and `last()`, which are occasionally useful. I agree that it feels weird to have indices attached to set elements, but it would at least make `entries()` useful. You could iterate and treat the first element and/or the last element differently. But the same can be achieved by iterating over a `zip()` of a set and a `range()` (assuming iterable-based tool functions `zip` and `range`). [1] http://docs.oracle.com/javase/7/docs/api/java/util/SortedSet.html -- Dr. Axel Rauschmayer a...@rauschma.de rauschma.de _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss