gcombination

package
v0.0.0-...-04ff805 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(set []interface{}) (subsets [][]interface{})

All returns all combinations for a given interface array. This is essentially a powerset of the given set except that the empty set is disregarded.

func AllInt

func AllInt(set []int) (subsets [][]int)

func AllIntWithLen

func AllIntWithLen(set []int, minLen, maxLen int) (subsets [][]int)

func AllString

func AllString(set []string) (subsets [][]string)
Example
combinations := AllString([]string{"A", "B", "C"})
fmt.Println(combinations)
Output:

[[A] [B] [A B] [C] [A C] [B C] [A B C]]

func AllStringWithLen

func AllStringWithLen(set []string, minLen, maxLen int) (subsets [][]string)
Example
ss := AllStringWithLen([]string{"A", "B", "C"}, 1, 2)
fmt.Println(ss)
Output:

[[A] [B] [A B] [C] [A C] [B C]]

func AllWithLen

func AllWithLen(set []interface{}, minLen, maxLen int) (subsets [][]interface{})

All returns all combinations for a given interface array and fixed set length. This is essentially a powerset of the given set except that the empty set is disregarded.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL