Documentation ¶
Overview ¶
Package unique provides primitives for sorting slices removing repeated elements.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Slice ¶
Slice sorts the slice pointed by the provided pointer given the provided less function and removes repeated elements. The function panics if the provided interface is not a pointer to a slice.
Example ¶
package main import ( "fmt" "github.com/campoy/unique" ) func main() { s := []int{3, 5, 1, 7, 2, 3, 7, 5, 2} less := func(i, j int) bool { return s[i] < s[j] } unique.Slice(&s, less) fmt.Println(s) }
Output: [1 2 3 5 7]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.