From ee6bb3959cab9369537f02f6ef84282c7d094362 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 30 Jan 2025 08:58:43 -0500 Subject: [PATCH] Removed function that wasn't being used in 'greg', moved to 'main' --- cmd/helpers.go | 14 ++++++++++++++ greg/misc.go | 11 ----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cmd/helpers.go b/cmd/helpers.go index e69de29..726e966 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -0,0 +1,14 @@ +package main + +import "slices" + +// 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 +} diff --git a/greg/misc.go b/greg/misc.go index 464c062..e310043 100644 --- a/greg/misc.go +++ b/greg/misc.go @@ -72,17 +72,6 @@ func allEqual[T comparable](items ...T) bool { return true } -// 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 -} - // Map function - convert a slice of T to a slice of V, based on a function // that maps a T to a V func Map[T, V any](slc []T, fn func(T) V) []V {