Documentation ¶
Overview ¶
Package permute provides a combination sequence iterator. Requires GOEXPERIMENT=rangefunc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinationIndices ¶ added in v0.24.2
CombinationIndices returns an iterator of indices over the length K combinations of an N sized set in lexicograph order. The yielded slice is reused and must be cloned if kept.
E.g. for N = 3 and K = 2, it sets the yielded slice to {0, 1}, then {0, 2}, and finally {1, 2}.
func Combinations ¶
Combinations takes a slice and returns an iterator over combinations of sub-slice combinations of length K. The yielded slice is reused and must be cloned if kept.
E.g. For []byte("abc"), 2; the yielded slice is set to "ab", "ac", and "bc" succesively.
func StringCombinations ¶ added in v0.24.2
StringCombinations takes a string and returns an iterator over combinations of sub-string combinations of length K. The yielded byte slice is reused and must be cloned or turned into a string if kept.
E.g. For "abc", 2; the yielded slice is set to "ab", "ac", and "bc" succesively.
Types ¶
This section is empty.