https://github.com/alexpantyukhin/combinations
Go lang combination package.
https://github.com/alexpantyukhin/combinations
cartesian-product combinations golang itertools permutation product
Last synced: 11 months ago
JSON representation
Go lang combination package.
- Host: GitHub
- URL: https://github.com/alexpantyukhin/combinations
- Owner: alexpantyukhin
- Created: 2018-11-24T07:27:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-29T20:30:05.000Z (over 7 years ago)
- Last Synced: 2025-03-25T14:21:36.172Z (12 months ago)
- Topics: cartesian-product, combinations, golang, itertools, permutation, product
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Combinations
A package with combinations functions from [python itertools](https://docs.python.org/3/library/itertools.html).
For now the following iterators are implemented :
- [x] Product (the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)).
- [x] Permutation (basing on the `Product` result).
- [x] Combination.
- [x] Combination with replacement.
# Installation
Just `go get` this repository with the following way:
```
go get github.com/alexpantyukhin/combinations
```
# Usage
```go
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())
}
}
```