Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Reduce ¶
func Reduce[T comparable, U any](s Set[T], f func(U, T) U, initialValue U) U
Reduce reduces the set to a single value.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set is a set. It is implemented as a map with empty structs.
func FromSlice ¶
func FromSlice[T comparable](s []T) Set[T]
FromSlice creates a new set from a slice.
func Map ¶
func Map[T, U comparable](s Set[T], f func(T) U) Set[U]
Map applies a function to all elements of the set.
Click to show internal directories.
Click to hide internal directories.