"Mathieu Bouchard" <matju / sympatico.ca> wrote in message news:Bjs47.45060$u76.1809272 / e420r-atl3.usenetserver.com... > > For example, when you iterate over a set (at least, the way I was taught > > in discrete math), you don't get any fixed ordering. Two possibilities > Let the user hang himself by providing him with over half of the semantics > of the Hash class, which iterates over a *set* of rows in a usually > chaotic and reproducible order but which is not guaranteed to be so. Later > provide both of Set and Hash with a randomizer if you wish to. But really... Ordered sets are very important. In market research software, we use ordered sets to store and manipulate (heh) answers, keeping track of the order in which the answers were given. They are also used to control the order in which a given subset should be presented to the user (respondent). And actually, we do sometimes randomize the set to avoid biases. Many of the array vs. set problems are something we have dealt with in a domain specific scripting language with semantics that are surprisingly similar to some of those found in Ruby. For example when turning an array into a set by doing set operations. Not initially, but eventually, we decided to always apply the unique operator to inputs of set operations. The unique operator would define the order by selecting first occurrence of every set member. Some more complex scenarios includes applying the order to a subset by applying the order from a superset. This is for example used when randomizing a set and later need a subset to have same relative ordering as the randomized set: OrderedSet / Subset -> OrderedSubset Mikkel