slice

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[S ~[]T, T any](s S, fn func(T) bool) S

Filter returns a new slice holding only the elements of s that satisfy fn.

func Map

func Map[In, Out any](s []In, fn func(In) Out) []Out

Map applies a provided function to each element of the given slice, returning a new slice with the results.

func NoZero

func NoZero[S ~[]T, T comparable](s S) S

NoZero removes zero values from the provided slice and returns a new slice containing only non-zero values of the same type. It maintains the order of the original elements.

func Unique

func Unique[S ~[]T, T comparable](s S) S

Unique removes duplicate elements from the provided slice, preserving the order of the first occurrence of each element. It returns a slice containing only the unique elements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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