73

GitHub - campoy/unique: Package unique provides primitives for sorting slices re...

 6 years ago
source link: https://github.com/campoy/unique
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

unique

Package unique provides primitives for sorting slices removing repeated elements.

a quick example

Executing this code:

	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)

Will output the following:

[1 2 3 5 7]

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK