Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compute ¶
func Compute[T any](set []T) [][]T
Compute returns the powerset of the given set.
Example ¶
package main import ( "fmt" "github.com/chanced/powerset" ) func main() { fmt.Println(powerset.Compute([]string{"a", "b", "c"})) fmt.Println(powerset.Compute([]int{1, 2, 3})) }
Output: [[] [a] [b] [a b] [c] [a c] [b c] [a b c]] [[] [1] [2] [1 2] [3] [1 3] [2 3] [1 2 3]]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.