
27 Aug
2008
27 Aug
'08
12:30 a.m.
John Meacham wrote:
nub has a couple advantages over the n log n version, the main one being that it only requires an 'Eq' constraint, not an 'Ord' one.
This is only an advantage for a tiny minority of types that have Eq but no Ord instances, such as TypRep. But there's no good reason why even this cannot have an Ord instance AFAICS (though not a derived one obviously).
another being that it is fully lazy, it produces results even for an infinite list.
As does the O(n*(log n)) AVL based nub I just wrote.
a third is that the results come out in the order they went in.
As does the O(n*(log n)) AVL based nub I just wrote :-) Regards -- Adrian Hey