A first version of obimicroasm...

This commit is contained in:
Eric Coissac
2025-02-16 21:47:49 +01:00
parent 4774438644
commit d70b0a5b42
11 changed files with 1234 additions and 27 deletions

20
pkg/obiutils/unique.go Normal file
View File

@@ -0,0 +1,20 @@
package obiutils
// Unique returns a new slice containing only unique values from the input slice.
// The order of elements in the output slice is not guaranteed to match the input order.
//
// Parameters:
// - slice: The input slice containing potentially duplicate values
//
// Returns:
// - A new slice containing only unique values
func Unique[T comparable](slice []T) []T {
// Create a map to track unique values
seen := Set[T]{}
for _, v := range slice {
seen.Add(v)
}
return seen.Members()
}