Loggest thine Stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
484 B

package genutils
func SliceWithUniques[T comparable](slice []T, elemsToAdd []T) []T {
newSlice := slice[:len(slice):len(slice)]
addLoop:
for _, elem := range elemsToAdd {
for _, existing := range slice {
if existing == elem {
continue addLoop
}
}
newSlice = append(newSlice, elem)
}
return newSlice
}
func SliceWithout[T comparable](originals []T, elemsToRemove []T) []T {
return Retain(originals, func(v T) bool {
return !Contains(elemsToRemove, v)
})
}