slices

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package slices provides generic higher-order functions over slices of values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlatMap

func FlatMap[X any, Y any](f func(X) []Y, xs []X) []Y

FlatMap applies function "f : X => []Y" to each value of the input slice, and returns a new slice of each output in sequence. The output sequence is "flattened" so that each slice returned by f is concatenated into a single slice.

If the input slice is a nil slice, the return value is also a nil slice. If f returns a nil slice, it is not included in the output.

For a lazy version, see the iter package.

func Map

func Map[X any, Y any](f func(X) Y, xs []X) []Y

Map applies function "f : X => Y" to each value of the input slice, and returns a new slice of each output in sequence.

If the input slice is a nil slice, the return value is also a nil slice.

For a lazy version, see the iter package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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