funcitr

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package funcitr provides functional styled iteration over collections of different types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterStrings

func FilterStrings(strings []string, filter func(string) bool) []string

FilterStrings iterates over a slice of strings calling the filter function for each value in the slice. The output slice contains contains all input strings for which the filter function returned true. Order is maintained from input to output.

func MapFloat32s

func MapFloat32s(floats []float32, mapFunc func(float32) float32) []float32

MapFloat32s iterates over a slice of floats calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

func MapFloat64s

func MapFloat64s(floats []float64, mapFunc func(float64) float64) []float64

MapFloat64s iterates over a slice of float64s calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

func MapInt64s

func MapInt64s(ints []int64, mapFunc func(int64) int64) []int64

MapInt64s iterates over a slice of int64s calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

func MapInts

func MapInts(ints []int, mapFunc func(int) int) []int

MapInts iterates over a slice of ints calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

func MapSlice

func MapSlice(sl []interface{}, mapFunc func(interface{}) interface{}) []interface{}

MapSlice iterates over a slice of calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

func MapStrings

func MapStrings(strings []string, mapFunc func(string) string) []string

MapStrings iterates over a slice of strings calling the mapping function for each value in the slice. The mapped values are returned in a new slice, and their order corresponds with the input slice (The Nth item in the output slice is the result returned by the mapping function when given the Nth item from the input slice.)

Types

This section is empty.

Jump to

Keyboard shortcuts

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