util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff[A ~[]S, S comparable](a, b A) (A, A)

Diff returns elements in a not in b and vice versa

func Map

func Map[A ~[]S, S interface{}, V interface{}](arr A, mapFn func(S) V) []V

Map returns mapping of arr using mapFn

func Select

func Select[A ~[]S, S interface{}](arr A, cmp func(S) bool) A

Select returns elements of arr where cmp(element)==true

func SliceToMap

func SliceToMap[K ~[]S, S interface{}, V comparable](arr K, keyFn func(S) V) map[V]S

SliceToMap returns map[keyFn(v)] = v for each v in arr

func SortedEqual

func SortedEqual[A ~[]S, S cmp.Ordered](a, b A) bool

SortedEqual returns true if a and b are equal if sorted

Types

This section is empty.

Jump to

Keyboard shortcuts

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