nubBy is:exact

The nubBy function behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded (==) function.

Examples

>>> nubBy (\x y -> mod x 3 == mod y 3) [1,2,4,5,6]
[1,2,6]
>>> nubBy (/=) [2, 7, 1, 8, 2, 8, 1, 8, 2, 8]
[2,2,2]
>>> nubBy (>) [1, 2, 3, 2, 1, 5, 4, 5, 3, 2]
[1,2,3,5,5]
The nubBy function behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded == function.
A version of nub with a custom comparison predicate. Note: This function makes use of sortByUniq using the intro sort algorithm.
The nubBy function behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded == function.
>>> nubBy (\x y -> mod x 3 == mod y 3) [1,2,4,5,6]
[1,2,6]
Generic version of nub
Drop repeated elements anywhere in the stream. Caution: not scalable for infinite streams See also: nubWindowBy Unimplemented
The nubBy function is the greedy algorithm that returns a sublist of its input such that:
isSortedBy pred (nubBy pred xs) == True
This is true for all lists, not just ordered lists, and all binary predicates, not just total orders. On infinite lists, this statement is true in a certain mathematical sense, but not a computational one.
Overloaded version of nub. Consider using nubOrdBy instead.
Delete all but the first copy of each element, with the given relation.
O(n^2). Behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded == function.
>>> nubBy (\x y -> mod x 3 == mod y 3) $ slist [1,2,4,5,6]
Slist {sList = [1,2,6], sSize = Size 3}