combs

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 0 Imported by: 3

README

Generic Combinations and Permutations

Tests

Although I don't anticipate using it much, I decided to give go generics a try. I've been known to toss the old void pointer around in C on occasion.

Documentation

Overview

Package combs provides generic functions for producing combinations and permutations from slices of any type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combinations

func Combinations[T any](n int, v []T) <-chan []T

Creates a channel that returns all combinations of n items from the slice v.

func Permutations

func Permutations[T any](a []T) <-chan []T

Creates a channel that returns all permutations of a slice of any type. Uses Heap's Algorithm (thanks wikipedia)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL