Question: How to sort a table by index

Likely has been asked before, but I cannot find the answer:

I have a table with a good number of entries, all of them indexed by strings. I'd like to sort the table by ascending index (i.e. alphabetically A...,B... etc) before I write the result to a file. Obviously, the entries have to stay with their respective indices.

Like:

Table([B=4,C=2,A=3]); to be sorted as A=3,B=4,C=2.

The sort command in Maple works with Arrays only; I understand.

I write it out in a FOR loop (FOR i in indices(table) DO...) so it would be sufficient if I could somehow get the indices worked on in alphabetical order.

How to?

Mac Dude

Please Wait...