slice

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStackEmpty = errors.New("stack is empty")
)

Functions

func ContainsFloat

func ContainsFloat(haystack []float64, needle float64) bool

ContainsFloat returns true if float needle is an element in float slice haystack

func ContainsInt

func ContainsInt(haystack []int, needle int) bool

ContainsInt returns true if int needle is an element in int slice haystack

func ContainsString

func ContainsString(haystack []string, needle string) bool

ContainsString returns true if string needle is an element in string slice haystack

func IntToString added in v1.1.15

func IntToString(in []int) []string

IntToString takes a slice of int and returns a slice of string.

func MedianFloats

func MedianFloats(in []float64) float64

MedianFloats gets the median number in the given slice of float64.

func MedianInts

func MedianInts(in []int) int

MedianInts gets the median number in the given slice of ints.

func StringToInt

func StringToInt(in []string) []int

StringToInt takes a slice of string and returns a slice of int.

func SumFloats

func SumFloats(in []float64) float64

SumFloats returns the sum of all elements in the given slice of float64.

func SumInts

func SumInts(in []int) int

SumInts returns the sum of all elements in the given slice of ints.

func UniqueInt

func UniqueInt(in []int) []int

UniqueInt takes a slice of int and returns a slice with only unique elements.

func UniqueString

func UniqueString(in []string, allowEmpty bool) []string

UniqueString takes a slice of string and returns a slice with only unique elements.

Types

type BoolStack added in v1.1.25

type BoolStack struct {
	// contains filtered or unexported fields
}

func (*BoolStack) Len added in v1.1.25

func (s *BoolStack) Len() int

func (*BoolStack) Peek added in v1.1.25

func (s *BoolStack) Peek() (bool, error)

func (*BoolStack) Pop added in v1.1.25

func (s *BoolStack) Pop() (bool, error)

func (*BoolStack) Push added in v1.1.25

func (s *BoolStack) Push(i bool)

type FloatStack added in v1.1.25

type FloatStack struct {
	// contains filtered or unexported fields
}

func (*FloatStack) Len added in v1.1.25

func (s *FloatStack) Len() int

func (*FloatStack) Peek added in v1.1.25

func (s *FloatStack) Peek() (float64, error)

func (*FloatStack) Pop added in v1.1.25

func (s *FloatStack) Pop() (float64, error)

func (*FloatStack) Push added in v1.1.25

func (s *FloatStack) Push(i float64)

type IntStack added in v1.1.25

type IntStack struct {
	// contains filtered or unexported fields
}

func (*IntStack) Len added in v1.1.25

func (s *IntStack) Len() int

func (*IntStack) Peek added in v1.1.25

func (s *IntStack) Peek() (int, error)

func (*IntStack) Pop added in v1.1.25

func (s *IntStack) Pop() (int, error)

func (*IntStack) Push added in v1.1.25

func (s *IntStack) Push(i int)

type StringStack added in v1.1.25

type StringStack struct {
	// contains filtered or unexported fields
}

func (*StringStack) Len added in v1.1.25

func (s *StringStack) Len() int

func (*StringStack) Peek added in v1.1.25

func (s *StringStack) Peek() (string, error)

func (*StringStack) Pop added in v1.1.25

func (s *StringStack) Pop() (string, error)

func (*StringStack) Push added in v1.1.25

func (s *StringStack) Push(i string)

Jump to

Keyboard shortcuts

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