From 2ccc3f8af5b945e04a06b3511e014e537230f745 Mon Sep 17 00:00:00 2001 From: Evan Burkey Date: Tue, 25 Jan 2022 13:43:10 -0800 Subject: [PATCH] Add documentation --- permutation.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/permutation.go b/permutation.go index ab0e1ae..6fb9ea8 100644 --- a/permutation.go +++ b/permutation.go @@ -1,7 +1,17 @@ +/* +Package permutation implements Heap's algorithm for generating permutations of +lists. It uses Go 1.18's new generics feature to provide a generic interface +*/ package permutation +// GenSlice is a generic slice of data type GenSlice[T any] []T +/* +Permutations uses Heap's Algorithm to generate a list of all possible +permutations of the provided list. Most slices will automatically coerce +their type into a GenSlice[T] with no casting required +*/ func Permutations[T any](arr GenSlice[T]) []GenSlice[T] { var helper func(GenSlice[T], int) var res []GenSlice[T]