A package with combinations functions from python itertools. For now the following iterators are implemented :
- Product (the Cartesian product).
- Permutation (basing on the
Product
result). - Combination.
- Combination with replacement.
Just go get
this repository with the following way:
go get github.com/alexpantyukhin/combinations
package main
import (
"fmt"
"github.com/alexpantyukhin/combinations"
)
func main() {
inter := []interface{}{0, 1, 2}
product, _ := combinations.NewProduct(inter, 3)
for product.Next() {
fmt.Println(product.Value())
}
}