Documentation
¶
Overview ¶
Example ¶
s1 := MakeFromString("1234567") s2 := MakeFromString("86420") fmt.Println(s1.Intersection(s2))
Output: Set{2 4 6}
Example (InvertedIndex) ¶
index := make(map[string]Set) index["CHESS"] = Make('♚', '♛', '♜', '♝', '♞', '♟', '♔', '♕', '♖', '♗', '♘', '♙') index["BLACK"] = Make('⚑', '■', '🖤', '★', '☎', '☻', '♚', '♛', '♜', '♝', '♞', '♟', '♠', '♣', '✂', '㉈') index["REGISTERED"] = Make('®') result := index["CHESS"].Intersection(index["BLACK"]) fmt.Println(result)
Output: Set{♚ ♛ ♜ ♝ ♞ ♟}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set map[rune]struct{}
Set represents a set of runes
func MakeFromString ¶
MakeFromString creates and returns a new Set
func (Set) Intersection ¶
Intersection returns a new set: the intersection of s AND other
func (Set) IntersectionUpdate ¶
IntersectionUpdate changes receiver in-place, keeping only elements that are in it AND in other.
Click to show internal directories.
Click to hide internal directories.