Safe Haskell | None |
---|---|
Language | Haskell2010 |
Create clusters of non-overlapping things.
Synopsis
- type C = Int
- cluster :: (a -> NonemptyList C) -> [a] -> [NonemptyList a]
- cluster' :: [(a, NonemptyList C)] -> [NonemptyList a]
Documentation
cluster :: (a -> NonemptyList C) -> [a] -> [NonemptyList a] Source #
Given a function f :: a -> NonemptyList C
which returns a non-empty list of
characteristics C
of a
, partition a list of a
s into groups
such that each element in a group shares at least one characteristic
with at least one other element of the group.
cluster' :: [(a, NonemptyList C)] -> [NonemptyList a] Source #
Partition a list of a
s paired with a non-empty list of
characteristics C
into groups
such that each element in a group shares at least one characteristic
with at least one other element of the group.