Skip to content

alexpantyukhin/combinations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Combinations

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.

Installation

Just go get this repository with the following way:

go get github.com/alexpantyukhin/combinations

Usage

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())
    }
}