Documentation ¶
Overview ¶
Package combinations provides a method to generate all combinations out of a given string array.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[T any](set []T) (subsets [][]T)
All returns all combinations for a given string array. This is essentially a powerset of the given set except that the empty set is disregarded.
Example ¶
combinations := All([]string{"A", "B", "C"}) fmt.Println(combinations)
Output: [[A] [B] [A B] [C] [A C] [B C] [A B C]]
func Combinations ¶ added in v1.1.0
Combinations returns combinations of n elements for a given string array. For n < 1, it equals to All and returns all combinations.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.