Dear Julia Colleagues,
I'm writing a balanced-tree library in Julia. Balanced trees can be used
to implement a sort-order dictionary, which is a particular implementation
of the "Associative" abstract type, so I write:
type SortOrderDict{K,V} <: Associative{K,V}
where SortOrderDict is my own project.
They can also be used to implement multimaps (like Dict except with
repeated keys) and sorted sets. For sorted sets I'd like to say:
type SortedSet{K} <: AbstractSet{K}
where AbstractSet{K} would also include Set{K} and IntSet as subtypes.
However, there is no such abstract type in Julia, and I'm wondering why it
was omitted.
Thanks,
Steve Vavasis
P.S. Something unexpected and very helpful happened with these types: When
I created a SortOrderDict and assigned it to x, and then I typed just 'x'
into the shell, I got a really nice printout of my SortOrderDict (it
printed out like a Dict, except in the sorted order of the keys). This
happened even though I never wrote a single line of code for printing out
SortOrderDicts! I suppose this happened because Julia has a default way to
print out any Associate{K,V} type.