slicex

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package slicex provides slice operations absent from the stdlib slices package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedup

func Dedup[T comparable](s []T) []T

Dedup returns a new slice with duplicate elements removed, preserving order. The first occurrence of each element is kept.

func Diff

func Diff[T cmp.Ordered](a, b []T) []T

Diff returns elements in a that are NOT present in b. Both slices must be sorted in ascending order. Runs in O(n+m).

func Intersect

func Intersect[T cmp.Ordered](a, b []T) []T

Intersect returns elements present in both a and b. Both slices must be sorted in ascending order. Runs in O(n+m).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL