Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/uniq: add new package #802

Merged
merged 1 commit into from Oct 2, 2020
Merged

util/uniq: add new package #802

merged 1 commit into from Oct 2, 2020

Conversation

josharian
Copy link
Contributor

@josharian josharian commented Oct 1, 2020

This change is Reviewable

@josharian
Copy link
Contributor Author

We don't really need this, but I always screw up the linear compaction thing, and it was fun to build.

util/uniq/slice.go Outdated Show resolved Hide resolved
util/uniq/slice.go Outdated Show resolved Hide resolved
@josharian
Copy link
Contributor Author

PTAL

util/uniq/slice.go Outdated Show resolved Hide resolved
util/uniq/slice.go Outdated Show resolved Hide resolved
@josharian josharian force-pushed the josh/uniq-slice branch 4 times, most recently from b170a6c to 79295c3 Compare October 1, 2020 23:35
util/uniq/slice.go Outdated Show resolved Hide resolved
util/uniq/slice.go Outdated Show resolved Hide resolved
util/uniq/slice.go Show resolved Hide resolved
This makes it easy to compact slices that contain duplicate elements
by sorting and then uniqing.

This is an alternative to constructing an intermediate map
and then extracting elements from it. It also provides
more control over equality than using a map key does.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
@josharian josharian merged commit 9784cae into main Oct 2, 2020
@josharian josharian deleted the josh/uniq-slice branch October 2, 2020 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants