sets

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var U = Unit{}

U is the unit

Functions

This section is empty.

Types

type Set

type Set[T comparable] map[T]Unit

Set of T is a map from T to Unit

func KeySet added in v0.0.21

func KeySet[TK comparable, TV any, TM ~map[TK]TV](src TM) Set[TK]

func NewSet

func NewSet[T comparable](elements ...T) Set[T]

NewSet creates a new set with initial elements

func (Set[T]) Add

func (s Set[T]) Add(elems ...T)

Add an element to the set

func (Set[T]) Contains

func (s Set[T]) Contains(element T) bool

func (Set[T]) Difference

func (s Set[T]) Difference(elements ...T) Set[T]

func (Set[T]) Intersection

func (s Set[T]) Intersection(elements ...T) Set[T]

func (Set[T]) MarshalJSON

func (s Set[T]) MarshalJSON() ([]byte, error)

func (Set[T]) MarshalYAML

func (s Set[T]) MarshalYAML() (interface{}, error)

func (Set[T]) SetDifference

func (s Set[T]) SetDifference(other Set[T]) Set[T]

func (Set[T]) SetIntersection

func (s Set[T]) SetIntersection(other Set[T]) Set[T]

func (Set[T]) SetUnion

func (s Set[T]) SetUnion(other Set[T]) Set[T]

func (Set[T]) String

func (s Set[T]) String() string

func (Set[T]) ThreeWay added in v0.0.21

func (s Set[T]) ThreeWay(other Set[T]) [3]Set[T]

func (Set[T]) Union

func (s Set[T]) Union(elements ...T) Set[T]

func (*Set[T]) UnmarshalJSON

func (s *Set[T]) UnmarshalJSON(data []byte) error

func (*Set[T]) UnmarshalYAML

func (s *Set[T]) UnmarshalYAML(value *yaml.Node) error

type Unit

type Unit = struct{}

Unit is an empty struct

Jump to

Keyboard shortcuts

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