[racket] Getting a list of keys in specified order
Hi all,
I need to get the list of all the keys, of a small collection of key/value pairs, in creation/insertion order.
I first thought of a hash, but hash-keys returns a list in (presumably) hash (i.e. no) order.
In the Reference for Dictionaries I see the Association List and the dict-keys function, and in testing I see dict-keys returns the keys, apparently in list order, when called with a small list of pairs. However, the Reference states I should assume no order.
Should I rejoice in the happy fact I have what I need for now and move on? Or should I copy/alter dict-keys to be sure?
Should I be using another type of data structure altogether (e.g. the queue from the Guide)? Or perhaps just use a hash to store the data and a vector to hold an index of the keys?
Also, in the object that holds a reference to the store of the key/value pairs, I find myself writing code like: (set! x (append x d)), where x is a vector or a list, and d is either the key or a key value pair. Is there a better way, or is this an accepted idiom to accumulate data in a vector or a list?.
Any feedback is gratefully received.
Cheers,
Kieron.