slices

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](slice []T, element T) (int, bool)

Contains searches for the element in the slice. It returns an index of the found element and a boolean indicator of whether the element was found in the collection. If the returned boolean indicator is false, the returned index is 0 but should not be used.

func Filter

func Filter[T any](slice []T, predicate func(T) bool) []T

Filter creates a copy of a slice with only the elements that satisfy the predicate.

func Sum added in v0.0.3

func Sum(s []int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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