lo

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package lo provides various utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference[S ~[]E, E cmp.Ordered](s1, s2 S) S

Difference returns elements that are present in s1 but not present in s2. Both s1 and s2 must be sorted.

func DifferenceFunc

func DifferenceFunc[S ~[]E, E any](s1, s2 S, cmp func(a, b E) int) S

DifferenceFunc is like Difference but uses a custom comparison function on each pair of elements.

func Intersection

func Intersection[S ~[]E, E cmp.Ordered](s1, s2 S) S

Intersection returns elements that are present in both s1 and s2. Both s1 and s2 must be sorted.

func IntersectionFunc

func IntersectionFunc[S ~[]E, E any](s1, s2 S, cmp func(a, b E) int) S

IntersectionFunc is like Intersection but uses a custom comparison function on each pair of elements.

func SymmetricDifference

func SymmetricDifference[S ~[]E, E cmp.Ordered](s1, s2 S) (S, S)

SymmetricDifference returns slices with elements unique to slices s1 and s2. First slice will contain elements that are present in s1 but not present in s2. Second slice will contain elements that are present in s2 but not present in s1. Both s1 and s2 must be sorted.

func SymmetricDifferenceFunc

func SymmetricDifferenceFunc[S ~[]E, E any](s1, s2 S, cmp func(a, b E) int) (S, S)

SymmetricDifferenceFunc is like SymmetricDifference but uses a custom comparison function on each pair of elements.

func Union

func Union[S ~[]E, E cmp.Ordered](s1, s2 S) S

Union returns unique elements from s1 and s2. Both s1 and s2 must be sorted.

func UnionFunc

func UnionFunc[S ~[]E, E any](s1, s2 S, cmp func(a, b E) int) S

UnionFunc is like Union but uses a custom comparison function on each pair of elements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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