slices

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Utilities for working with slices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAll

func DeleteAll[S ~[]E, E comparable](slice S, valueToDelete E) S

Delete all occurrences of valueToDelete in slice

func DeleteFirst

func DeleteFirst[S ~[]E, E comparable](slice S, valueToDelete E) S

Delete the first occurrence of valueToDelete in slice

func Map

func Map[T any, U any](values []T, fun func(T) U) []U

Return a new slice where slice[i] = fun(values[i]) for all i

func MergeSorted

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

Merge two sorted slices to produce a third sorted slice without duplicates

func MergeSortedFunc

func MergeSortedFunc[T any](a, b []T, compare func(T, T) int) []T

Merge two sorted slices to produce a third sorted slice without duplicates, using the given comparison function

func Shuffle

func Shuffle[S ~[]E, E any](s S)

Shuffle a slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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