Updated map and reduce function names so that they aren't exported

This commit is contained in:
2025-01-30 09:52:00 -05:00
parent f6d56b74e1
commit 24a5045ebe
2 changed files with 9 additions and 9 deletions

View File

@@ -74,7 +74,7 @@ func allEqual[T comparable](items ...T) bool {
// 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 {
func funcMap[T, V any](slc []T, fn func(T) V) []V {
toReturn := make([]V, len(slc))
for i, val := range slc {
toReturn[i] = fn(val)
@@ -84,7 +84,7 @@ func Map[T, V any](slc []T, fn func(T) V) []V {
// Reduce function - reduces a slice of a type into a value of the type,
// based on the given function.
func Reduce[T any](slc []T, fn func(T, T) T) T {
func funcReduce[T any](slc []T, fn func(T, T) T) T {
if len(slc) == 0 {
panic("Reduce on empty slice.")
}