internal

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concatenate added in v0.0.4

func Concatenate[T any](slices ...[]T) []T

Concatenate concatenates multiple slices of type T into a single slice. The function takes a variadic number of slices and returns a new slice containing all elements of the input slices, preserving the order.

func Mean

func Mean[T Number](data []T) float64

Mean calculates the mean (average) of the numeric values in the given slice.

func Sum

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

Sum calculates the sum of all numbers in the given slice.

func Values

func Values[M ~map[K]V, K comparable, V any](m M) []V

Values extracts the values from a map and returns them as a slice.

Types

type Number

type Number interface {
	int | uint | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | float32 | float64
}

Number represents a numeric type that can be used for arithmetic operations. It includes int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, and float64.

Jump to

Keyboard shortcuts

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