From 7231169270f9e5ba688b913fd179e08250a7f8a9 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Sun, 9 Feb 2025 09:13:03 -0500 Subject: [PATCH] Removed unused functions --- regex/misc.go | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/regex/misc.go b/regex/misc.go index 2d21e61..38b5313 100644 --- a/regex/misc.go +++ b/regex/misc.go @@ -48,49 +48,6 @@ func isNormalChar(c rune) bool { return !slices.Contains(specialChars, c) } -// Ensure that the given elements are only appended to the given slice if they -// don't already exist. Returns the new slice, and the number of unique items appended. -func uniqueAppend[T comparable](slc []T, items ...T) ([]T, int) { - num_appended := 0 - for _, item := range items { - if !slices.Contains(slc, item) { - slc = append(slc, item) - num_appended++ - } - } - return slc, num_appended -} - -func uniqueAppendFunc[T any](slc []T, fn func(T, T) bool, items ...T) ([]T, int) { - toRet := make([]T, len(slc)) - num_appended := 0 - copy(toRet, slc) - for _, item := range items { - itemExists := false - for _, val := range slc { - if fn(item, val) { - itemExists = true - } - } - if !itemExists { - toRet = append(toRet, item) - num_appended++ - } - } - return toRet, num_appended -} - -// Returns true only if all the given elements are equal -func allEqual[T comparable](items ...T) bool { - first := items[0] - for _, item := range items { - if item != first { - return false - } - } - return true -} - // Map function - convert a slice of T to a slice of V, based on a function // that maps a T to a V func funcMap[T, V any](slc []T, fn func(T) V) []V {