Agda-2.6.2.1: A dependently typed functional programming language and proof assistant
Safe HaskellSafe-Inferred
LanguageHaskell2010

Agda.Utils.Cluster

Description

Create clusters of non-overlapping things.

Synopsis

Documentation

type C = Int Source #

Characteristic identifiers.

cluster :: (a -> NonEmpty C) -> [a] -> [NonEmpty a] Source #

Given a function f :: a -> NonEmpty C which returns a non-empty list of characteristics C of a, partition a list of as 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, NonEmpty C)] -> [NonEmpty a] Source #

Partition a list of as 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.