Documentation ¶
Overview ¶
Package set implements a set type for strings and integers.
Index ¶
- type Int
- func (s Int) Add(keys ...int)
- func (s Int) Contains(key int) bool
- func (s Int) Copy() Int
- func (s Int) Delete(keys ...int)
- func (s Int) Difference(ints ...Int) (difference Int)
- func (s Int) Equal(other Int) bool
- func (s Int) Filter(f func(int) bool) Int
- func (s Int) IUnion(ints ...Int)
- func (s Int) Intersection(ints ...Int) (intersection Int)
- func (s Int) IsDisjoint(other Int) bool
- func (s Int) IsProperSubset(other Int) bool
- func (s Int) IsProperSuperset(other Int) bool
- func (s Int) IsSubset(other Int) bool
- func (s Int) IsSuperset(other Int) bool
- func (s Int) Map(f func(int) int) Int
- func (s Int) Pop() (k int, more bool)
- func (s Int) Reduce(f func(int, int) int) (int, bool)
- func (s Int) Remove(key int) bool
- func (s Int) Sorted() []int
- func (s Int) ToSlice() []int
- func (s Int) Union(ints ...Int) (union Int)
- func (s Int) XOR(other Int) Int
- type String
- func (s String) Add(keys ...string)
- func (s String) Contains(key string) bool
- func (s String) Copy() String
- func (s String) Difference(strings ...String) (difference String)
- func (s String) Equal(other String) bool
- func (s String) Filter(f func(string) bool) String
- func (s String) IUnion(strings ...String)
- func (s String) Intersection(strings ...String) (intersection String)
- func (s String) IsDisjoint(other String) bool
- func (s String) IsProperSubset(other String) bool
- func (s String) IsProperSuperset(other String) bool
- func (s String) IsSubset(other String) bool
- func (s String) IsSuperset(other String) bool
- func (s String) Map(f func(string) string) String
- func (s String) Pop() (k string, more bool)
- func (s String) Reduce(f func(string, string) string) (string, bool)
- func (s String) Remove(key string) bool
- func (s String) Sorted() []string
- func (s String) ToSlice() []string
- func (s String) Union(strings ...String) (union String)
- func (s String) XOR(other String) String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int ¶
type Int map[int]signal
Int is a set of ints. Remember to initialize with make(Int) or Int{}
func (Int) Difference ¶
Difference returns the items in the reciever but not any other arguments
func (Int) Filter ¶
Filter applies a filtering function across the set, returning a set containing x where f(x) is true.
func (Int) Intersection ¶
Intersection returns a new set containing the intersection of the ints;
func (Int) IsDisjoint ¶
IsDisjoint returns true if s∩other == Ø; that is, s shares no elements with other. Note that the empty set is disjoint with everything.
func (Int) IsProperSubset ¶
IsProperSubset returns true if every s ⊂ other: every key in s is also in other and s != other
func (Int) IsProperSuperset ¶
IsProperSuperset returns true if other ⊂ s; every key in other is also in s and s != other
func (Int) IsSuperset ¶
IsSuperset returns true if other ⊆ s; every key in other is also in s
func (Int) Map ¶
Map a function f(x) across the set, returning a new set containing f(x) for all x in the set.
func (Int) Pop ¶
Pop an arbitrary element from the set. Returns 0, false if no more elements remain. No order (or lack of order) is guaranteed.
func (Int) Reduce ¶
Reduce applies a reducing function across the set. It will return (0, false) for a set with zero entries.
func (Int) Sorted ¶
Sorted returns a slice containing the sorted keys of the set in the usual order.
type String ¶
type String map[string]signal
String is a set of strings. Remember to initialize with make or String{}
func FromStrings ¶
FromStrings creates a set from strings
func (String) Difference ¶
Difference returns the items in the reciever but not any other arguments
func (String) Filter ¶
Filter applies a filtering function across the set, returning a set containing x where f(x) is true.
func (String) Intersection ¶
Intersection returns a new set containing the intersection of the strings;
func (String) IsDisjoint ¶
IsDisjoint returns true if s shared no elements with other. Note that the empty set is disjoint with everything.
func (String) IsProperSubset ¶
IsProperSubset returns true if every key in s is also in other and s != other
func (String) IsProperSuperset ¶
IsProperSuperset returns true if every key in other is also in s and s != other
func (String) IsSuperset ¶
IsSuperset returns true if every key in other is also in s
func (String) Map ¶
Map a function f(x) across the set, returning a new set containing f(x) for all x in the set.
func (String) Pop ¶
Pop an arbitrary element from the set. Returns "", false if no more elements remain. No order, or lack of order, is guaranteed.
func (String) Reduce ¶
Reduce applies a reducing function across the set. It will return (0, false) for a set with zero entries.
func (String) ToSlice ¶
ToSlice returns a slice containing the keys of a set. No order is guaranteed.