chore: add mercury

This commit is contained in:
xuu
2024-01-22 16:00:58 -07:00
parent b1cc2af8d8
commit 21b2c439fc
52 changed files with 6634 additions and 52 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
"go.sour.is/pkg/math"
"golang.org/x/exp/maps"
)
type Set[T comparable] map[T]struct{}
@@ -33,6 +34,9 @@ func (s Set[T]) Delete(items ...T) Set[T] {
}
return s
}
func (s Set[T]) Values() []T {
return maps.Keys(s)
}
func (s Set[T]) Equal(e Set[T]) bool {
for k := range s {