provide a way to run app

This commit is contained in:
2024-08-10 14:14:38 +03:00
parent ba6ac26bac
commit 0046755c7d
10 changed files with 468 additions and 168 deletions

25
pkg/collections/set.go Normal file
View File

@ -0,0 +1,25 @@
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
}