[E-Lang] Operators #2: Comparison
Ralph Hartley
hartley@aic.nrl.navy.mil
Tue, 10 Apr 2001 10:53:58 -0400
Ka-Ping Yee wrote:
> On Mon, 9 Apr 2001, Ralph Hartley wrote:
>
>> Not defining it at all has its merits, but comparing the sets of keys
>> isn't right anyway. The comparison of two maps should depend on the
>> values, not just the keys. Here is a try at a definition:
>
>
> Just for reference, in Python dictionaries compare according to the
> lexicographic order of their sorted (key, value) lists. This is
> expensive, but it seems to be the only easily understandable answer.
My definition should be the same for sortable maps. The tricky bit,
which I am not at all sure I got right, is what to do when the maps have
keys that are not comparable. You could just say that such maps are not
comparable, but that isn't compatible with the obvious definition of
equivalence.
Ralph Hartley