You can use a comprehension over the Dict to get an array of count, string pairs and then sort that in place, which avoids some copying.
> On Jun 15, 2014, at 3:03 PM, TR NS <[email protected]> wrote: > > > >> On Sunday, June 15, 2014 10:48:16 AM UTC-4, Stefan Karpinski wrote: >> Works for me. What version of Julia are you using? Note that if you have the >> integer before the string in each tuple, you can just sort the array. > > Turns out I was trying to sort a Dict. Once I wrapped it in collect() it > worked. Seems a little ugly though to first have to convert it to an array of > tuples and then sort using `x->x[2]`. Might there be a way to sort Dicts > directly? (Though obviously the result would not be Dict). > > Good to know about the integer being before the string, though it won't help > in this particular case. The Dict stores a word key and frequency value. I am > counting the frequency of words in a corpus. > > Thanks.
