Performance horrors

Neil Mitchell ndmitchell at gmail.com
Tue Aug 26 07:13:04 EDT 2008


Hi

> The folklore (such as it is) for uniq is that it is trivially defined
> like so (for lists):
>
>> uniq = map head . group . sort
>
> and so perhaps is not worthy of library inclusion? BTW, is this a
> suitably performant definition, or would we benefit from a lower-level
> implementation?

A much better definition would use a Data.Set, then you get laziness
and the order of elements is not permuted. Having a sortNub as well is
a good idea though.

Thanks

Neil


More information about the Libraries mailing list