Documentation
¶
Overview ¶
Package set provides primitives for inserting distinct values into ordered sets.
Example ¶
package main
import (
"fmt"
"sort"
"dasa.cc/x/set"
)
func main() {
a := []string{
"a", "b", "c",
"b", "c", "d",
"c", "d", "e",
}
// filter without allocating
b := set.Slice[string](a[:0])
for _, x := range a {
b.Insert(x)
}
fmt.Println(b)
fmt.Println("sorted", sort.StringsAreSorted(b))
}
Output: [a b c d e] sorted true
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chain ¶
type Chain[T constraints.Ordered] []Slice[T]
Chain is always strictly ordered by its indices, given as [0 .. N-1].
type Simple ¶
type Simple[T constraints.Ordered] []T
Simple is always strictly ordered by its indices, given as [0 .. N-1].
Click to show internal directories.
Click to hide internal directories.