Documentation
¶
Index ¶
- func AsSlice[E Id, S Constraint[E]](s S) []E
- func Equal[E Id, S Constraint[E], T Constraint[E]](s S, t T) bool
- func IntersectMap[T Id, U any](target map[T]U, using Hash[T])
- type Constraint
- type Hash
- func Difference[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
- func FromMap[T Id, U any](from map[T]U) Hash[T]
- func FromSlice[T Id](from []T) Hash[T]
- func Intersection[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
- func MapFromSlice[T Id, U any](from []U, g func(U) T) Hash[T]
- func New[T Id]() Hash[T]
- func Union[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
- type Id
- type Operation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsSlice ¶
func AsSlice[E Id, S Constraint[E]](s S) []E
transforms a hashset into a slice, order is not gauranteed
func Equal ¶
func Equal[E Id, S Constraint[E], T Constraint[E]](s S, t T) bool
returns true if S and T have the same elements recorded
func IntersectMap ¶
removes keys from the target map that do not exist in the provided set
Types ¶
type Constraint ¶
type Constraint[T Id] interface { ~map[T]entry }
type Hash ¶
type Hash[T Id] map[T]entry
func Difference ¶
func Difference[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
return a new set that contains all keys in S that are not in T
func Intersection ¶
func Intersection[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
return a new set with only items present in both sets
func MapFromSlice ¶
creates a new hashset by mapping over a slice to return the values
func Union ¶
func Union[E Id, S Constraint[E], T Constraint[E]](s S, t T) Hash[E]
returns new set that contains all keys from S and T
type Id ¶
type Id interface { comparable }
type Operation ¶
type Operation[E Id, S Constraint[E], T Constraint[E]] func(s S, t T) Hash[E]
allows operations between types that wrap a hashset
Click to show internal directories.
Click to hide internal directories.