Unique-0.3: It provides the functionality like unix "uniq" utility

Portabilityportable
StabilityUnstable
Maintainerualinuxcn@gmail.com
Safe HaskellSafe-Inferred

Data.List.Unique

Description

Library provides the functions to find unique and duplicate elements in the list

Synopsis

Documentation

sortUniq :: Ord a => [a] -> [a]Source

sortUniq sorts the list and removes the duplicates of elements. Example:

sortUniq foo bar == abfor

repeated :: Ord a => [a] -> [a]Source

repeated finds only the elements that are present more than once in the list. Example:

repeated foo bar == o

repeatedBy :: Ord a => (Int -> Bool) -> [a] -> [a]Source

The repeatedBy function behaves just like repeated, except it uses a user-supplied equality predicate.

repeatedBy (>2) This is the test line == eist

unique :: Ord a => [a] -> [a]Source

unique gets only unique elements, that do not have duplicates. It sorts them. Example:

unique foo bar == abfr

count :: Ord a => [a] -> [(a, Int)]Source

count of each element in the list, it sorts by keys (elements). Example:

count foo bar == [(' ',1),(a,1),(b,1),(f,1),(o,2),(r,1)]

count_ :: Ord a => [a] -> [(a, Int)]Source

count_ of each elements in the list, it sorts by their number. Example:

count_ foo bar == [(' ',1),(a,1),(b,1),(f,1),(r,1),(o,2)]

countElem :: Eq a => a -> [a] -> IntSource

countElem gets the number of occurrences of the specified element. Example:

countElem o foo bar == 2