instance Ord FiniteMap

Johannes Waldmann joe@isun.informatik.uni-leipzig.de
Wed, 29 May 2002 20:53:29 +0200 (MET DST)


> > setToList will be very inefficient (or at least much more so than an
> > instance which actually looks at the tree structure).

this would be much more difficult to design,
since one and the same set may be represented by quite different trees:
they might have been created by inserting elements in different order,
triggering different re-balancings.

I find that I use Set and FiniteMap rather for reasons of clarity in coding. 
This is what `you guys in industry' call `academic programming', right :-)
If speed is really an important issue,
then one would have to resort to some kind of hash table lookup anyway.

In the above case, using setToList shouldn't be that much of a problem:
given two `average' sets (of course there is no such thing, but anyway),
there is good chance that they differ in one of the smaller elements,
so the list of nodes (of the tree representing the set)
would only be evaluated to a small extent.
-- 
-- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ --
-- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --