Documentation ¶
Overview ¶
Package set implements utility functions for manipulating sets of primitive type elements represented as maps.
For each primitive type "foo", the package provides global variables Foo and FooBool that implement utility functions for map[foo]struct{} and map[foo]bool respectively. For each such variable, the package provides:
methods for conversion between sets represented as maps and slices: FromSlice(slice) and ToSlice(set)
methods for common set operations: Difference(s1, s2), Intersection(s1, s2), and Union(s1, s2); note that these functions store their result in the first argument
For instance, one can use these functions as follows:
s1 := set.String.FromSlice([]string{"a", "b"}) s2 := set.String.FromSlice([]string{"b", "c"}) set.String.Difference(s1, s2) // s1 == {"a"} set.String.Intersection(s1, s2) // s1 == {} set.String.Union(s1, s2) // s1 == {"b", "c"}
Index ¶
- Variables
- type Complex128BoolT
- func (Complex128BoolT) Difference(s1, s2 map[complex128]bool)
- func (Complex128BoolT) FromSlice(els []complex128) map[complex128]bool
- func (Complex128BoolT) Intersection(s1, s2 map[complex128]bool)
- func (Complex128BoolT) ToSlice(s map[complex128]bool) []complex128
- func (Complex128BoolT) Union(s1, s2 map[complex128]bool)
- type Complex128T
- func (Complex128T) Difference(s1, s2 map[complex128]struct{})
- func (Complex128T) FromSlice(els []complex128) map[complex128]struct{}
- func (Complex128T) Intersection(s1, s2 map[complex128]struct{})
- func (Complex128T) ToSlice(s map[complex128]struct{}) []complex128
- func (Complex128T) Union(s1, s2 map[complex128]struct{})
- type Complex64BoolT
- func (Complex64BoolT) Difference(s1, s2 map[complex64]bool)
- func (Complex64BoolT) FromSlice(els []complex64) map[complex64]bool
- func (Complex64BoolT) Intersection(s1, s2 map[complex64]bool)
- func (Complex64BoolT) ToSlice(s map[complex64]bool) []complex64
- func (Complex64BoolT) Union(s1, s2 map[complex64]bool)
- type Complex64T
- func (Complex64T) Difference(s1, s2 map[complex64]struct{})
- func (Complex64T) FromSlice(els []complex64) map[complex64]struct{}
- func (Complex64T) Intersection(s1, s2 map[complex64]struct{})
- func (Complex64T) ToSlice(s map[complex64]struct{}) []complex64
- func (Complex64T) Union(s1, s2 map[complex64]struct{})
- type Float32BoolT
- type Float32T
- type Float64BoolT
- type Float64T
- type Int16BoolT
- type Int16T
- type Int32BoolT
- type Int32T
- type Int64BoolT
- type Int64T
- type Int8BoolT
- type Int8T
- type IntBoolT
- type IntT
- type StringBoolT
- type StringT
- type Uint16BoolT
- type Uint16T
- type Uint32BoolT
- type Uint32T
- type Uint64BoolT
- type Uint64T
- type Uint8BoolT
- type Uint8T
- type UintBoolT
- type UintT
- type UintptrBoolT
- type UintptrT
Constants ¶
This section is empty.
Variables ¶
var Complex128 = Complex128T{}
var Complex128Bool = Complex128BoolT{}
var Complex64 = Complex64T{}
var Complex64Bool = Complex64BoolT{}
var Float32 = Float32T{}
var Float32Bool = Float32BoolT{}
var Float64 = Float64T{}
var Float64Bool = Float64BoolT{}
var Int = IntT{}
var Int16 = Int16T{}
var Int16Bool = Int16BoolT{}
var Int32 = Int32T{}
var Int32Bool = Int32BoolT{}
var Int64 = Int64T{}
var Int64Bool = Int64BoolT{}
var Int8 = Int8T{}
var Int8Bool = Int8BoolT{}
var IntBool = IntBoolT{}
var String = StringT{}
var StringBool = StringBoolT{}
var Uint = UintT{}
var Uint16 = Uint16T{}
var Uint16Bool = Uint16BoolT{}
var Uint32 = Uint32T{}
var Uint32Bool = Uint32BoolT{}
var Uint64 = Uint64T{}
var Uint64Bool = Uint64BoolT{}
var Uint8 = Uint8T{}
var Uint8Bool = Uint8BoolT{}
var UintBool = UintBoolT{}
var Uintptr = UintptrT{}
var UintptrBool = UintptrBoolT{}
Functions ¶
This section is empty.
Types ¶
type Complex128BoolT ¶
type Complex128BoolT struct{}
func (Complex128BoolT) Difference ¶
func (Complex128BoolT) Difference(s1, s2 map[complex128]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Complex128BoolT) FromSlice ¶
func (Complex128BoolT) FromSlice(els []complex128) map[complex128]bool
FromSlice transforms the given slice to a set.
func (Complex128BoolT) Intersection ¶
func (Complex128BoolT) Intersection(s1, s2 map[complex128]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Complex128BoolT) ToSlice ¶
func (Complex128BoolT) ToSlice(s map[complex128]bool) []complex128
ToSlice transforms the given set to a slice.
func (Complex128BoolT) Union ¶
func (Complex128BoolT) Union(s1, s2 map[complex128]bool)
Union merges s1 and s2, storing the result in s1.
type Complex128T ¶
type Complex128T struct{}
func (Complex128T) Difference ¶
func (Complex128T) Difference(s1, s2 map[complex128]struct{})
Difference subtracts s2 from s1, storing the result in s1.
func (Complex128T) FromSlice ¶
func (Complex128T) FromSlice(els []complex128) map[complex128]struct{}
FromSlice transforms the given slice to a set.
func (Complex128T) Intersection ¶
func (Complex128T) Intersection(s1, s2 map[complex128]struct{})
Intersection intersects s1 and s2, storing the result in s1.
func (Complex128T) ToSlice ¶
func (Complex128T) ToSlice(s map[complex128]struct{}) []complex128
ToSlice transforms the given set to a slice.
func (Complex128T) Union ¶
func (Complex128T) Union(s1, s2 map[complex128]struct{})
Union merges s1 and s2, storing the result in s1.
type Complex64BoolT ¶
type Complex64BoolT struct{}
func (Complex64BoolT) Difference ¶
func (Complex64BoolT) Difference(s1, s2 map[complex64]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Complex64BoolT) FromSlice ¶
func (Complex64BoolT) FromSlice(els []complex64) map[complex64]bool
FromSlice transforms the given slice to a set.
func (Complex64BoolT) Intersection ¶
func (Complex64BoolT) Intersection(s1, s2 map[complex64]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Complex64BoolT) ToSlice ¶
func (Complex64BoolT) ToSlice(s map[complex64]bool) []complex64
ToSlice transforms the given set to a slice.
func (Complex64BoolT) Union ¶
func (Complex64BoolT) Union(s1, s2 map[complex64]bool)
Union merges s1 and s2, storing the result in s1.
type Complex64T ¶
type Complex64T struct{}
func (Complex64T) Difference ¶
func (Complex64T) Difference(s1, s2 map[complex64]struct{})
Difference subtracts s2 from s1, storing the result in s1.
func (Complex64T) FromSlice ¶
func (Complex64T) FromSlice(els []complex64) map[complex64]struct{}
FromSlice transforms the given slice to a set.
func (Complex64T) Intersection ¶
func (Complex64T) Intersection(s1, s2 map[complex64]struct{})
Intersection intersects s1 and s2, storing the result in s1.
func (Complex64T) ToSlice ¶
func (Complex64T) ToSlice(s map[complex64]struct{}) []complex64
ToSlice transforms the given set to a slice.
func (Complex64T) Union ¶
func (Complex64T) Union(s1, s2 map[complex64]struct{})
Union merges s1 and s2, storing the result in s1.
type Float32BoolT ¶
type Float32BoolT struct{}
func (Float32BoolT) Difference ¶
func (Float32BoolT) Difference(s1, s2 map[float32]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Float32BoolT) FromSlice ¶
func (Float32BoolT) FromSlice(els []float32) map[float32]bool
FromSlice transforms the given slice to a set.
func (Float32BoolT) Intersection ¶
func (Float32BoolT) Intersection(s1, s2 map[float32]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Float32BoolT) ToSlice ¶
func (Float32BoolT) ToSlice(s map[float32]bool) []float32
ToSlice transforms the given set to a slice.
func (Float32BoolT) Union ¶
func (Float32BoolT) Union(s1, s2 map[float32]bool)
Union merges s1 and s2, storing the result in s1.
type Float32T ¶
type Float32T struct{}
func (Float32T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Float32T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Float64BoolT ¶
type Float64BoolT struct{}
func (Float64BoolT) Difference ¶
func (Float64BoolT) Difference(s1, s2 map[float64]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Float64BoolT) FromSlice ¶
func (Float64BoolT) FromSlice(els []float64) map[float64]bool
FromSlice transforms the given slice to a set.
func (Float64BoolT) Intersection ¶
func (Float64BoolT) Intersection(s1, s2 map[float64]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Float64BoolT) ToSlice ¶
func (Float64BoolT) ToSlice(s map[float64]bool) []float64
ToSlice transforms the given set to a slice.
func (Float64BoolT) Union ¶
func (Float64BoolT) Union(s1, s2 map[float64]bool)
Union merges s1 and s2, storing the result in s1.
type Float64T ¶
type Float64T struct{}
func (Float64T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Float64T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Int16BoolT ¶
type Int16BoolT struct{}
func (Int16BoolT) Difference ¶
func (Int16BoolT) Difference(s1, s2 map[int16]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Int16BoolT) FromSlice ¶
func (Int16BoolT) FromSlice(els []int16) map[int16]bool
FromSlice transforms the given slice to a set.
func (Int16BoolT) Intersection ¶
func (Int16BoolT) Intersection(s1, s2 map[int16]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Int16BoolT) ToSlice ¶
func (Int16BoolT) ToSlice(s map[int16]bool) []int16
ToSlice transforms the given set to a slice.
func (Int16BoolT) Union ¶
func (Int16BoolT) Union(s1, s2 map[int16]bool)
Union merges s1 and s2, storing the result in s1.
type Int16T ¶
type Int16T struct{}
func (Int16T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Int16T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Int32BoolT ¶
type Int32BoolT struct{}
func (Int32BoolT) Difference ¶
func (Int32BoolT) Difference(s1, s2 map[int32]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Int32BoolT) FromSlice ¶
func (Int32BoolT) FromSlice(els []int32) map[int32]bool
FromSlice transforms the given slice to a set.
func (Int32BoolT) Intersection ¶
func (Int32BoolT) Intersection(s1, s2 map[int32]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Int32BoolT) ToSlice ¶
func (Int32BoolT) ToSlice(s map[int32]bool) []int32
ToSlice transforms the given set to a slice.
func (Int32BoolT) Union ¶
func (Int32BoolT) Union(s1, s2 map[int32]bool)
Union merges s1 and s2, storing the result in s1.
type Int32T ¶
type Int32T struct{}
func (Int32T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Int32T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Int64BoolT ¶
type Int64BoolT struct{}
func (Int64BoolT) Difference ¶
func (Int64BoolT) Difference(s1, s2 map[int64]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Int64BoolT) FromSlice ¶
func (Int64BoolT) FromSlice(els []int64) map[int64]bool
FromSlice transforms the given slice to a set.
func (Int64BoolT) Intersection ¶
func (Int64BoolT) Intersection(s1, s2 map[int64]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Int64BoolT) ToSlice ¶
func (Int64BoolT) ToSlice(s map[int64]bool) []int64
ToSlice transforms the given set to a slice.
func (Int64BoolT) Union ¶
func (Int64BoolT) Union(s1, s2 map[int64]bool)
Union merges s1 and s2, storing the result in s1.
type Int64T ¶
type Int64T struct{}
func (Int64T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Int64T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Int8BoolT ¶
type Int8BoolT struct{}
func (Int8BoolT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Int8BoolT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Int8T ¶
type Int8T struct{}
func (Int8T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Int8T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type IntBoolT ¶
type IntBoolT struct{}
func (IntBoolT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (IntBoolT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type IntT ¶
type IntT struct{}
func (IntT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (IntT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type StringBoolT ¶
type StringBoolT struct{}
func (StringBoolT) Difference ¶
func (StringBoolT) Difference(s1, s2 map[string]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (StringBoolT) FromSlice ¶
func (StringBoolT) FromSlice(els []string) map[string]bool
FromSlice transforms the given slice to a set.
func (StringBoolT) Intersection ¶
func (StringBoolT) Intersection(s1, s2 map[string]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (StringBoolT) ToSlice ¶
func (StringBoolT) ToSlice(s map[string]bool) []string
ToSlice transforms the given set to a slice.
func (StringBoolT) Union ¶
func (StringBoolT) Union(s1, s2 map[string]bool)
Union merges s1 and s2, storing the result in s1.
type StringT ¶
type StringT struct{}
func (StringT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (StringT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Uint16BoolT ¶
type Uint16BoolT struct{}
func (Uint16BoolT) Difference ¶
func (Uint16BoolT) Difference(s1, s2 map[uint16]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Uint16BoolT) FromSlice ¶
func (Uint16BoolT) FromSlice(els []uint16) map[uint16]bool
FromSlice transforms the given slice to a set.
func (Uint16BoolT) Intersection ¶
func (Uint16BoolT) Intersection(s1, s2 map[uint16]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Uint16BoolT) ToSlice ¶
func (Uint16BoolT) ToSlice(s map[uint16]bool) []uint16
ToSlice transforms the given set to a slice.
func (Uint16BoolT) Union ¶
func (Uint16BoolT) Union(s1, s2 map[uint16]bool)
Union merges s1 and s2, storing the result in s1.
type Uint16T ¶
type Uint16T struct{}
func (Uint16T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Uint16T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Uint32BoolT ¶
type Uint32BoolT struct{}
func (Uint32BoolT) Difference ¶
func (Uint32BoolT) Difference(s1, s2 map[uint32]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Uint32BoolT) FromSlice ¶
func (Uint32BoolT) FromSlice(els []uint32) map[uint32]bool
FromSlice transforms the given slice to a set.
func (Uint32BoolT) Intersection ¶
func (Uint32BoolT) Intersection(s1, s2 map[uint32]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Uint32BoolT) ToSlice ¶
func (Uint32BoolT) ToSlice(s map[uint32]bool) []uint32
ToSlice transforms the given set to a slice.
func (Uint32BoolT) Union ¶
func (Uint32BoolT) Union(s1, s2 map[uint32]bool)
Union merges s1 and s2, storing the result in s1.
type Uint32T ¶
type Uint32T struct{}
func (Uint32T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Uint32T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Uint64BoolT ¶
type Uint64BoolT struct{}
func (Uint64BoolT) Difference ¶
func (Uint64BoolT) Difference(s1, s2 map[uint64]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Uint64BoolT) FromSlice ¶
func (Uint64BoolT) FromSlice(els []uint64) map[uint64]bool
FromSlice transforms the given slice to a set.
func (Uint64BoolT) Intersection ¶
func (Uint64BoolT) Intersection(s1, s2 map[uint64]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Uint64BoolT) ToSlice ¶
func (Uint64BoolT) ToSlice(s map[uint64]bool) []uint64
ToSlice transforms the given set to a slice.
func (Uint64BoolT) Union ¶
func (Uint64BoolT) Union(s1, s2 map[uint64]bool)
Union merges s1 and s2, storing the result in s1.
type Uint64T ¶
type Uint64T struct{}
func (Uint64T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Uint64T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type Uint8BoolT ¶
type Uint8BoolT struct{}
func (Uint8BoolT) Difference ¶
func (Uint8BoolT) Difference(s1, s2 map[uint8]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (Uint8BoolT) FromSlice ¶
func (Uint8BoolT) FromSlice(els []uint8) map[uint8]bool
FromSlice transforms the given slice to a set.
func (Uint8BoolT) Intersection ¶
func (Uint8BoolT) Intersection(s1, s2 map[uint8]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (Uint8BoolT) ToSlice ¶
func (Uint8BoolT) ToSlice(s map[uint8]bool) []uint8
ToSlice transforms the given set to a slice.
func (Uint8BoolT) Union ¶
func (Uint8BoolT) Union(s1, s2 map[uint8]bool)
Union merges s1 and s2, storing the result in s1.
type Uint8T ¶
type Uint8T struct{}
func (Uint8T) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (Uint8T) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type UintBoolT ¶
type UintBoolT struct{}
func (UintBoolT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (UintBoolT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type UintT ¶
type UintT struct{}
func (UintT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (UintT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
type UintptrBoolT ¶
type UintptrBoolT struct{}
func (UintptrBoolT) Difference ¶
func (UintptrBoolT) Difference(s1, s2 map[uintptr]bool)
Difference subtracts s2 from s1, storing the result in s1.
func (UintptrBoolT) FromSlice ¶
func (UintptrBoolT) FromSlice(els []uintptr) map[uintptr]bool
FromSlice transforms the given slice to a set.
func (UintptrBoolT) Intersection ¶
func (UintptrBoolT) Intersection(s1, s2 map[uintptr]bool)
Intersection intersects s1 and s2, storing the result in s1.
func (UintptrBoolT) ToSlice ¶
func (UintptrBoolT) ToSlice(s map[uintptr]bool) []uintptr
ToSlice transforms the given set to a slice.
func (UintptrBoolT) Union ¶
func (UintptrBoolT) Union(s1, s2 map[uintptr]bool)
Union merges s1 and s2, storing the result in s1.
type UintptrT ¶
type UintptrT struct{}
func (UintptrT) Difference ¶
Difference subtracts s2 from s1, storing the result in s1.
func (UintptrT) Intersection ¶
Intersection intersects s1 and s2, storing the result in s1.
Source Files ¶
- complex128.go
- complex128bool.go
- complex64.go
- complex64bool.go
- doc.go
- float32.go
- float32bool.go
- float64.go
- float64bool.go
- int.go
- int16.go
- int16bool.go
- int32.go
- int32bool.go
- int64.go
- int64bool.go
- int8.go
- int8bool.go
- intbool.go
- string.go
- stringbool.go
- uint.go
- uint16.go
- uint16bool.go
- uint32.go
- uint32bool.go
- uint64.go
- uint64bool.go
- uint8.go
- uint8bool.go
- uintbool.go
- uintptr.go
- uintptrbool.go