Skip to content

add slice.Dedup and slice.DedupBy#17

Merged
mikehelmick merged 1 commit into
mainfrom
slice/dedup
Apr 5, 2026
Merged

add slice.Dedup and slice.DedupBy#17
mikehelmick merged 1 commit into
mainfrom
slice/dedup

Conversation

@mikehelmick
Copy link
Copy Markdown
Owner

Proposed Changes

  • slice.Dedup — removes consecutive duplicate elements, keeping the first of each run; requires comparable elements
  • slice.DedupBy — removes consecutive elements that produce the same key via KeyFn, keeping the first; reuses the existing KeyFn[T, K] type from frequencies.go

Note: only adjacent duplicates are removed, matching Elixir's Enum.dedup/1 semantics.

Release Note

Add slice.Dedup and slice.DedupBy.

🤖 Parts of this PR were written with Claude Code

Dedup removes consecutive duplicate elements, keeping the first of each
run (requires comparable elements). DedupBy removes consecutive elements
that produce the same key according to a KeyFn, keeping the first.
Both reuse the existing KeyFn type from frequencies.go.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label Apr 5, 2026
@mikehelmick mikehelmick merged commit 8686107 into main Apr 5, 2026
3 checks passed
@mikehelmick mikehelmick deleted the slice/dedup branch April 5, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant