:: (a -> a) -> [a] -> [[a]] -package:utility-ht

The groupWith function uses the user supplied function which projects an element out of every list element in order to first sort the input list and then to form groups by equality on these projected elements
A combination of group and sort, using a part of the value to compare on.
groupSortOn length ["test","of","sized","item"] == [["of"],["test","item"],["sized"]]
A version of group where the equality is done on some extracted value.
groupOn abs [1,-1,2] == [[1,-1], [2]]
Classify values based on the result of a given function.
> classifyOn head ["sheep", "chip", "ship", "cheap"]
[["sheep","ship"],["chip","cheap"]]
> classifyOn odd [1,2,3,4,5,6]
[[1,3,5],[2,4,6]]
(cf. classify, classifyBy)
Group values using a given field selector.
O(n). This is a replacement for groupWith using discrimination. The result equivalence classes are not sorted, but the grouping is stable.