From 9657a1ad88180e2508836e3cf5981f1b33f58c54 Mon Sep 17 00:00:00 2001 From: Giuliano Panzironi <45801466+giulianopz@users.noreply.github.com> Date: Sun, 19 May 2024 19:47:36 +0200 Subject: [PATCH] chore: update API comments after PR #12 changed input to generic arrays (#15) --- README.md | 2 +- combinations.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 339f95f..4622e00 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/mxschmitt/golang-combinations)](https://goreportcard.com/report/github.com/mxschmitt/golang-combinations) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -This package provides a method to generate all ordered combinations out of a given string array. +This package provides a method to generate all ordered combinations out of a given generic array. This essentially creates the powerset of the given array except that the empty set is disregarded. ## Examples diff --git a/combinations.go b/combinations.go index 2d9e34a..a17d40e 100644 --- a/combinations.go +++ b/combinations.go @@ -1,9 +1,9 @@ -// Package combinations provides a method to generate all combinations out of a given string array. +// Package combinations provides a method to generate all combinations out of a given generic array. package combinations import "math/bits" -// All returns all combinations for a given string array. +// All returns all combinations for a given generic array. // This is essentially a powerset of the given set except that the empty set is disregarded. func All[T any](set []T) (subsets [][]T) { length := uint(len(set)) @@ -27,7 +27,7 @@ func All[T any](set []T) (subsets [][]T) { return subsets } -// Combinations returns combinations of n elements for a given string array. +// Combinations returns combinations of n elements for a given generic array. // For n < 1, it equals to All and returns all combinations. func Combinations[T any](set []T, n int) (subsets [][]T) { length := uint(len(set))