[Haskell-cafe] Create a list without duplicates from a list with duplicates

Henning Thielemann lemming at henning-thielemann.de
Fri Feb 8 08:23:02 EST 2008


On Fri, 8 Feb 2008, news at lyra.net wrote:

> Hallo!
>
> Let's suppose I have a list [a,b,c,d,c,d]. I'd like to write
> a function that returns a new list without duplicates (in
> the example [a,b,c,d]). How can I do that? What is the most
> general way? I'd like to use the same function for a list of
> Int or String or some other user defined data type.

List.nub


I assume you couldn't find this function due its cryptic name. Don't
worry, many others failed before.


More information about the Haskell-Cafe mailing list