algorithms

package
v0.0.0-...-54d5358 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

package algorithms provides generified map/filter/reduce functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal[T comparable](first, second T, rest ...T) bool

Equal returns true if all elements are equal.

func Filter

func Filter[T any](s []T, f func(T) bool) []T

Filter returns a new slice containing all elements of the slice that satisfy the predicate function.

func Map

func Map[T, R any](s []T, f func(T) R) []R

Map applies the function f to each element of the slice and returns a new slice containing the results.

func Reverse

func Reverse[T any](a []T)

Reverse reverses the order of the elements in the slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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