On Saturday, May 23, 2015 at 4:15:37 PM UTC-4, Scott Jones wrote: > > I know *how* to write this myself, as I would in C, but I'd like to know > if one of the built-in datatypes (or a package) in Julia would handle this > for me without me having to write much code... > I will be building up an array or dict or whatever with a key, where need > to keep track of number of occurrences and a flag that indicates whether it > is > present in group 1, group 2, or both... > I then need to sort it first by the group (group 1 first, then present in > both, then group 2), and within the groups by frequency... >
You could just use an OrderedDict (from DataStructures.jl) mapping keys to tuples of (group,frequency), where group=2 if it is in group 1, =1 if it is in both, and =0 if it is in group 2. Tuples sort lexicographically, so this will sort in the order you want.
