Documentation
¶
Overview ¶
Package slices provides complementary functions to slices package from standard library.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapFunc ¶
func MapFunc[E1, E2 any](s []E1, f func(E1) E2) []E2
MapFunc transforms every item in the sequence to a new sequence of items generated by function f.
Example ¶
package main
import (
"fmt"
"github.com/skhal/lab/go/slices"
)
func main() {
nn := slices.MapFunc([]int{1, 2, 3}, func(n int) int { return n * 2 })
fmt.Println(nn)
}
Output: [2 4 6]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.