It is the insertion order. I am just converting this code for pure fun and make some tests. I will definitively have a look at Leo's code as well!
Feel free to have a look at the attached examples. This “dictionary implementation” (it’s somewhat pretentious to call it like that) uses a simple sequence of XQuery maps with single entries. It’s faster than I had initially expected, but for sure it cannot beat the native map implementation.