package collections type Set[V comparable] map[V]struct{} func NewSet[V comparable](values ...V) Set[V] { out := make(map[V]struct{}, len(values)) for _, value := range values { out[value] = struct{}{} } return out } func (s Set[V]) Array() []V { out := make([]V, 0, len(s)) for k := range s { out = append(out, k) } return out } func (s Set[V]) Contains(other V) bool { _, ok := s[other] return ok }