choose
is a small package for the Go Programming Language that produces all combinations of M out of N items. The core part of the code is based on Matthew Belmonte's C implementation of Phillip J. Chase's Algorithm 382: Combinations of M out of N Objects.
The choose
package has opted into the Go module system so installation is in fact unnecessary if your program or package has done likewise. Otherwise, a traditional
go get github.com/spakin/choose
will install the package.
See the choose
API reference for details, but the basic usage model is to invoke a function that accepts a slice and returns a channel, then iterate over that channel's contents, each of which is a slice of the same type as the input.