lists

package
v0.0.0-...-ad25402 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](s []T, i T) bool

func Fill

func Fill[T any](x int, def T) []T

func Fill2D

func Fill2D[T any](x, y int, def T) [][]T

func Filter

func Filter[S ~[]E, E any](s S, predicate func(E) bool) S

func Intersection

func Intersection[T comparable](a, b []T) []T

func Map

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

func MapMap

func MapMap[T, U any, V, W comparable](s map[V]T, f func(V, T) (W, U)) map[W]U

func Range

func Range[N math.Number](a, b N) []N

func Reduce

func Reduce[T any, U any](s []T, f func(U, T) U) U

func Reverse

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

Types

type Pair

type Pair[T, U any] struct {
	Key T
	Val U
}

type Pairs

type Pairs[T, U any] []Pair[T, U]

func MapToSlice

func MapToSlice[T comparable, U any](s map[T]U) Pairs[T, U]

func (Pairs[T, U]) Keys

func (p Pairs[T, U]) Keys() []T

func (Pairs[T, U]) Vals

func (p Pairs[T, U]) Vals() []U

type Queue

type Queue[T any] []T

func (*Queue[T]) Pop

func (q *Queue[T]) Pop() T

func (*Queue[T]) Push

func (q *Queue[T]) Push(items ...T)

type Stack

type Stack[T any] []T

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(items ...T)

Jump to

Keyboard shortcuts

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