package slices

import "cuelang.org/go/internal/slices"

Index

Functions

func Clip

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

Clip removes unused capacity from the slice, returning s[:len(s):len(s)].

func Equal

func Equal[S ~[]E, E comparable](s1, s2 S) bool

Equal reports whether two slices are equal: the same length and all elements equal. If the lengths are different, Equal returns false. Otherwise, the elements are compared in increasing index order, and the comparison stops at the first unequal pair. Floating point NaNs are not considered equal.

func Reverse

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

Reverse reverses the elements of the slice in place.

Source Files

slices.go

Version
v0.8.0-alpha.1
Published
Feb 12, 2024
Platform
windows/amd64
Last checked
6 minutes ago

Tools for package owners.