Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.
/ array Public archive

Array methods implemented using generics in Go

Notifications You must be signed in to change notification settings

tsivinsky/array

Repository files navigation

array methods

This is me practicing generics and testing in Go

go get -u github.com/tsivinsky/array

array.Each

array.Each[T any](slice []T, func (item T, i int))

array.Map

array.Map[T any, M any](slice []T, func(item T, i int) M) []M

array.Reduce

array.Reduce[T any, M any](slice []T, func(accumulator M, currentValue T) M, initialValue M) M

array.Some

array.Some[T any](slice []T, func(item T, i int) bool) bool

array.Every

array.Every[T any](slice []T, func(item T, i int) bool) bool

array.Find

array.Find[T any](slice []T, func (item T, i int) bool) T

array.FindIndex

array.FindIndex[T any](slice []T, func (item T, i int) bool) int

array.Filter

array.Filter[T any](slice []T, func (item T, i int) bool) []T

array.Includes

array.Includes[T comparable](slice []T, item T) bool

array.At

Try passing negative number as second argument

array.At[T any](s []T, i int) T

About

Array methods implemented using generics in Go

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages