set

package
v0.0.0-...-cd3051e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear[T comparable](s Set[T])

func Equal

func Equal[T comparable](a Set[T], b Set[T]) bool

func New

func New[T comparable]() *set[T]

func Pick

func Pick[T comparable](s Set[T]) T

func Subset

func Subset[T comparable](a Set[T], b Set[T]) bool

Reports whether the second set is within the first set.

Types

type Set

type Set[T comparable] interface {
	Add(T)
	Enumerate() []T

	Remove(T)
	Contains(T) bool

	Size() int
}

func Build

func Build[T comparable](values ...T) Set[T]

func CreateFrom

func CreateFrom[T comparable](s Set[T]) Set[T]

func CreateWithCapacity

func CreateWithCapacity[T comparable](n int) Set[T]

func Difference

func Difference[T comparable](a Set[T], b Set[T]) Set[T]

The set of elements in the second set but not in the first set

func Filter

func Filter[T comparable](s Set[T], f func(T) bool) Set[T]

func Intersection

func Intersection[T comparable](a Set[T], b Set[T]) Set[T]

func Map

func Map[K comparable, V comparable](s Set[K], f func(K) V) Set[V]

func Pop

func Pop[T comparable](s Set[T]) (T, Set[T])

func Rest

func Rest[T comparable](s Set[T], value T) Set[T]

func Union

func Union[T comparable](a Set[T], b Set[T]) Set[T]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL