Does the association <|a -> 1, b -> 2, c -> 3|> in Mathematica have order or not? If I iterate the association multiple times, is it guaranteed that the items will be iterated in the same order?

  • 1
    $\begingroup$ I have not used association much, but for me, it makes little sense to talk about "order" of keys. The point is that one gives a key, and gets the value associated with that key by a lookup. Like a hash table. If you depend on an "order" of keys in the lookup table to do something, then I think you are doing something wrong. $\endgroup$ – Nasser Apr 5 '15 at 7:53
  • $\begingroup$ @Nasser: It's not the most frequent use case, but sometimes you want to aggregate data in an Association, then later process the key/value pairs in the order they were discovered. And I often find it handy that BarChart, ListPlot&friends don't jumble association data I pass them. So I'm glad Wolfram made them ordered. $\endgroup$ – Niki Estner Apr 5 '15 at 11:35
  • $\begingroup$ @nikie Thanks for clarification :) $\endgroup$ – m00nlight Apr 6 '15 at 12:31

Browse other questions tagged or ask your own question.