Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A combinatorics package for Go

License

NotificationsYou must be signed in to change notification settings

klaidliadon/next

Repository files navigation

GoDocBuild Statuscodecov.io

The package calculates asynchronously combinations and permutations of a collection of values.

To add the package recommended:

go get klaidliadon.dev/next

Functionalities

  • Combinations
  • Combinations with repetitions
  • Permutations
  • Permutations with repetitions

Usage

Just use create a new channel usingCombination() orPermutation() and receive the results.

package mainimport ("fmt""klaidliadon.dev/next")func main() {for v := range next.Combination([]interface{}{1,2,3,4}, 2, true) {fmt.Println(v)}}

Produces

[1 1][1 2][1 3][1 4][2 2][2 3][2 4][3 3][3 4][4 4]

Roadmap

The 4 main cases of combinatronics are covered:

  • Combinations
  • Combinations with repetitions
  • Permutations
  • Permutations with repetitions

The future updates will improve performance and memory usage.

About

A combinatorics package for Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp