slice_util

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountElements

func CountElements[T comparable](xs []T) map[T]int

CountElements counts the number of times that element occurs in the slice.

func SliceToSet

func SliceToSet[T comparable](xs []T) map[T]int

SliceToSet returns the set of elements in the slice where the keys in the map that return for the elements in the set.

func SubtractSet

func SubtractSet[T comparable](xs, ys map[T]int) map[T]int

SubtractSet returns the set of elements in xs that are not in ys. This is the same as the "relative complement" of ys with respect to xs. The sets can be generated using SliceToSet.

func SubtractSlice

func SubtractSlice[T comparable](xs, ys []T) []T

SubtractSlice returns the slice of elements in xs that are not in ys. This is the same as the "relative complement" of ys with respect to xs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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