v0.0.73
This commit is contained in:
parent
ff08d5f180
commit
72883cf6bd
@ -265,6 +265,16 @@ func ArrMap[T1 any, T2 any](arr []T1, conv func(v T1) T2) []T2 {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ArrFilterMap[T1 any, T2 any](arr []T1, filter func(v T1) bool, conv func(v T1) T2) []T2 {
|
||||||
|
r := make([]T2, 0, len(arr))
|
||||||
|
for _, v := range arr {
|
||||||
|
if filter(v) {
|
||||||
|
r = append(r, conv(v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
func ArrSum[T NumberConstraint](arr []T) T {
|
func ArrSum[T NumberConstraint](arr []T) T {
|
||||||
var r T = 0
|
var r T = 0
|
||||||
for _, v := range arr {
|
for _, v := range arr {
|
||||||
|
Loading…
Reference in New Issue
Block a user