Renamed 'cmd' to 'kg' so that go install works correctly

This commit is contained in:
2025-03-28 09:06:12 -04:00
parent 595b86df60
commit 4c4d747a9c
3 changed files with 0 additions and 0 deletions

27
kg/helpers.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import "slices"
type character interface {
int | rune
}
// Returns all elements in slice A that are NOT in slice B
func setDifference[T comparable](s1 []T, s2 []T) []T {
toReturn := make([]T, 0, len(s1))
for _, val := range s1 {
if !slices.Contains(s2, val) {
toReturn = append(toReturn, val)
}
}
return toReturn
}
// Generate numbers in a range - start (inclusive) to end (exclusive)
func genRange[T character](start, end T) []T {
toRet := make([]T, end-start)
for i := start; i < end; i++ {
toRet[i-start] = i
}
return toRet
}