Agda-2.8.0: 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

- cluster :: Ord c => (a -> NonEmpty c) -> [a] -> [NonEmpty a]
- cluster' :: Ord c => [(a, NonEmpty c)] -> [NonEmpty a]
- cluster1 :: Ord c => (a -> NonEmpty c) -> NonEmpty a -> NonEmpty (NonEmpty a)
- cluster1' :: Ord c => NonEmpty (a, NonEmpty c) -> NonEmpty (NonEmpty a)

# Documentation

cluster :: Ord c => (a -> NonEmpty c) -> [a] -> [NonEmpty a] Source #

Given a function `f :: a -> NonEmpty c` which returns a non-empty list of characteristics 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' :: Ord c => [(a, NonEmpty c)] -> [NonEmpty a] Source #

Partition a list of `a`s paired with a non-empty list of characteristics into groups such that each element in a group shares at least one characteristic with at least one other element of the group.

cluster1 :: Ord c => (a -> NonEmpty c) -> NonEmpty a -> NonEmpty (NonEmpty a) Source #

Given a function `f :: a -> NonEmpty c` which returns a non-empty list of characteristics of `a`, partition a non-empty 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.

cluster1' :: Ord c => NonEmpty (a, NonEmpty c) -> NonEmpty (NonEmpty a) Source #

Partition a non-empty list of `a`s paired with a non-empty list of characteristics into groups such that each element in a group shares at least one characteristic with at least one other element of the group.