internal

package
v0.0.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeLevenshteinDistance added in v0.0.8

func ComputeLevenshteinDistance(s1, s2 string) int

ComputeLevenshteinDistance calculates the Levenshtein distance between two strings. It measures the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.

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