Lets say you have an ordered dict:
using DataStructures
cur_dict = OrderedDict()
And you then do two rounds of key inserts:
foreach(cur_value -> cur_dict[cur_value] = cur_value+rand()/2, 1:2:9)
foreach(cur_value -> cur_dict[cur_value] = cur_value+rand()/4, 2:4:10)
This gives:
> cur_dict
OrderedDict{Any,Any} with 8 entries:
1 => 1.14616
3 => 3.2501
5 => 5.26185
7 => 7.40121
9 => 9.20038
2 => 2.02592
6 => 6.11011
10 => 10.2155
Is there a way to reorder the OrderedDict
, so that the keys are sorted under some new sort function?
// i.e. by sort(collect(keys(cur_dict))) == [1, 2, 3, 5, 6, 7, 9, 10]