xslices

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear added in v0.7.6

func Clear[E any](s []E)

Clear sets every element of s to the zero value of E.

TODO: Replace with clear() builtin when Go 1.21 comes out?

func Filter added in v0.7.3

func Filter[E any, S ~[]E](s S, keep func(E) bool) S

Filter removes any elements from s for which keep(element) is false.

func Partition

func Partition[E any, S ~[]E](s S, pred func(E) bool) (t, f S)

Partition returns two slices, t and f. t contains all elements of s for which pred() returns true, and f contains all elements for which pred() returns false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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