Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Utils.Cluster

Description

Create clusters of non-overlapping things.

Synopsis

- type C = Int
- cluster :: (a -> (C, [C])) -> [a] -> [[a]]
- cluster' :: [(a, (C, [C]))] -> [[a]]

# Documentation

type C = Int #

Characteristic identifiers.

cluster :: (a -> (C, [C])) -> [a] -> [[a]] #

Given a function `f :: a -> (C,[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, (C, [C]))] -> [[a]] #

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.