> 1.  elems     :: Set a -> [a]
>     setToList :: Set a -> [a]
> 
>   These two look like synonyms, but have different comments.
>   Am I missing something? 

Both functions compute the same list, and IMHO the comments state the
same.

> 2.  size :: Set a -> Int    -- O(1) ...
> 
>   And for large sets, the user needs to program
> 
>   genericSize :: Set a -> Integer  
>   genericSize =  genericLength . Data.Set.elems
>   ?
>   Is this possible to make it O(1) too?

No, 'genericSize' cannot work in O(1) time, but by looking at the source
you will see that a 'Set' contains an element representing its size, so
'size' can work in constant time.

Regards,

        Jens
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to