On 2019-04-07 16:24:52 +0000, Cym13 said:

You could use sort to gather the indexes in order then traverse from there:

     aa.byKey.array.sort!((a, b) => aa[a]<aa[b])

That doesn't work: Error: no property array for type Result

With a wrapper caching that order and making it transparent as well as update on insertion (which should be in log(n) since you know have an ordered list of indexes, you can use dichotomy to update the indexes without walking all your AA again) I think you could have a nice little container. However if double entry is necessary maybe a simpler 2D array would be easier to work with?

At the point where I need this sorted array, nothing will change it. It's a log output. So, not necessary to make things more complex.

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to