combinations

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: Unlicense Imports: 0 Imported by: 0

README

generic combinations in golang

docs: https://pkg.go.dev/fiatjaf.com/lib/combinations

[source,go]
----
c := combinations.Combinations([]string{"a", "b", "c"}, 2)
fmt.Println(c)
// Output:
// {{"a" "b"} {"a" "c"} {"b" "c"}}
----

based on https://medium.com/codex/generating-combinations-efficiently-with-asifs-algorithm-d453e803893

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combinations

func Combinations[V any](arr []V, r int) [][]V

Combinations generates all combinations of r elements from arr.

Types

This section is empty.

Jump to

Keyboard shortcuts

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