Module Set
Christian Maeder
maeder@Informatik.Uni-Bremen.DE
Sat, 27 Jul 2002 14:24:20 +0200
Hi,
I think the module Set lacks at least a (partial) function
minimum :: forall a. (Ord a) => Set a -> a
because "setToList" is the only (though sufficient) function to access
the elements of a list. Will "minimum = head . setToList" be correct or
do I need to sort the list?
I was considering using sorted lists directly, but I thought the
functions `elem` and `union` are not as efficient as they could be
(under the assumption that the input lists are sorted). Surely balanced
trees will be better for large sets.
Besides the minimum, also the maximum or the simultaneous splitting of a
set into its minimum and the remaining set would be useful (for
recursions).
Cheers Christian