Table of Contents

Method Partitions

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Gamelogic.Extensions.dll

Partitions<T>(IEnumerable<T>)

Returns all the set partitions of the given list.

public static IEnumerable<IEnumerable<IEnumerable<T>>> Partitions<T>(this IEnumerable<T> list)

Parameters

list IEnumerable<T>

The list to partition.

Returns

IEnumerable<IEnumerable<IEnumerable<T>>>

An enumerable of partitions, where each partition is a collection of non-empty, non-overlapping subsets that together contain all elements.

Type Parameters

T

The type of elements in the list.

Remarks

If the list is (a b c), then ((a) (b c)) and ((a) (b) (c)) are examples of partitions.