array

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAt

func AppendAt[T arrTypes](a []T, i int, v []T) []T

AppendAt appends the newValue at the index i.

func Filter

func Filter[T arrTypes](a []T, f func(T) bool) []T

Filter returns a new array containing only the elements that satisfy the predicate f.

func In

func In[T arrTypes](arr []T, key T) (exists bool, i int, val T)

In returns the index of the first element in the array that equals the searchKey.

func InsertAt

func InsertAt[T arrTypes](a []T, i int, v T) []T

InsertAt inserts the newValue at the index i.

func Map

func Map[T arrTypes](arr []T, f func(T) T) []T

Map applies the function f to each element of the array and returns the result.

func Reduce

func Reduce[T arrTypes](a []T, f func(T, T) T) T

Reduce applies the function f to each element of the array and returns the result.

func RemoveAt

func RemoveAt[T arrTypes](a []T, i int) []T

RemoveAt removes the element at the index i.

func RemoveElem added in v1.0.1

func RemoveElem[T arrTypes](a []T, searchKey T) []T

RemoveElem removes the first element in the array that equals the searchKey.

func Replace

func Replace[T arrTypes](arr []T, key T, replacer T) []T

Replace replaces the first element in the array that equals the searchKey with the newValue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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