xslices

package
v1.0.10 Latest Latest
Warning

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

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

README

xslices

import "github.com/fufuok/utils/generic/xslices"

Index

func Average

func Average[T generic.Numeric](xs []T) float64

Average 求数字切片的平均值

func Deduplication

func Deduplication[E comparable](s []E) []E

Deduplication removes repeatable elements from s.

func Filter

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

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

func Max

func Max[T cmp.Ordered](xs ...T) (y T)

func Merge

func Merge[E any](s []E, ss ...[]E) []E

Merge 浅拷贝合并多个切片, 不影响原切片

func Min

func Min[T cmp.Ordered](xs ...T) (y T)

func ToString

func ToString[T any](xs []T, sep string) string

ToString 将切片拼接成字符串

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Average added in v1.0.10

func Average[T generic.Numeric](xs []T) float64

Average 求数字切片的平均值

func Deduplication

func Deduplication[E comparable](s []E) []E

Deduplication removes repeatable elements from s.

func Filter

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

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

func Max added in v1.0.10

func Max[T cmp.Ordered](xs ...T) (y T)

func Merge

func Merge[E any](s []E, ss ...[]E) []E

Merge 浅拷贝合并多个切片, 不影响原切片

func Min added in v1.0.10

func Min[T cmp.Ordered](xs ...T) (y T)

func ToString added in v1.0.10

func ToString[T any](xs []T, sep string) string

ToString 将切片拼接成字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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