add new map nil
This commit is contained in:
parent
4b8ccf12b4
commit
72d2bd6dc0
6
map.go
6
map.go
|
@ -1,5 +1,11 @@
|
||||||
package lambda
|
package lambda
|
||||||
|
|
||||||
|
func MapNil[T any](xs []T, fx func(T)) {
|
||||||
|
for _, v := range xs {
|
||||||
|
fx(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func Map[T any](xs []T, fx func(T) T) []T {
|
func Map[T any](xs []T, fx func(T) T) []T {
|
||||||
for i, v := range xs {
|
for i, v := range xs {
|
||||||
xs[i] = fx(v)
|
xs[i] = fx(v)
|
||||||
|
|
Loading…
Reference in New Issue