slicesx

package
v0.0.0-...-2d47422 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anys

func Anys[S ~[]E, E any](ts []S) []any

func Avg

func Avg[T Number](ts []T) float64

func Chunks

func Chunks[S ~[]E, E any](ts S, chunkSize int) [][]E

func Dedup

func Dedup[S ~[]E, E comparable](ts S) []E

func DedupFnc

func DedupFnc[S ~[]E, E comparable](ts S, eqFnc func(t1, t2 E) bool) []E

func Filter

func Filter[S ~[]E, E any](ts S, accept func(t E) bool) []E

func FindDoFnc

func FindDoFnc[S ~[]T, T any](ts S, fnc func(t T) bool, do func(t *T))

func FindFnc

func FindFnc[S ~[]T, T any](ts S, fnc func(t T) bool) (T, bool)

func Map

func Map[T any, V any](ts []T, conv func(T) V) []V

func Repeat

func Repeat[T any](t T, count int) []T

func Sum

func Sum[T Number](ts []T) T

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

Jump to

Keyboard shortcuts

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