Documentation ¶
Index ¶
- Variables
- func ContainsFloat(haystack []float64, needle float64) bool
- func ContainsInt(haystack []int, needle int) bool
- func ContainsString(haystack []string, needle string) bool
- func IntToString(in []int) []string
- func MedianFloats(in []float64) float64
- func MedianInts(in []int) int
- func StringToInt(in []string) []int
- func SumFloats(in []float64) float64
- func SumInts(in []int) int
- func ToInterface[T any](in []T) []interface{}
- func Unique[T comparable](in []T) []T
- func UniqueInt(in []int) []int
- func UniqueString(in []string, allowEmpty bool) []string
- type BoolStack
- type FloatStack
- type IntStack
- type StringStack
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrStackEmpty = errors.New("stack is empty")
)
Functions ¶
func ContainsFloat ¶
ContainsFloat returns true if float needle is an element in float slice haystack
func ContainsInt ¶
ContainsInt returns true if int needle is an element in int slice haystack
func ContainsString ¶
ContainsString returns true if string needle is an element in string slice haystack
func IntToString ¶ added in v1.1.15
IntToString takes a slice of int and returns a slice of string.
func MedianFloats ¶
MedianFloats gets the median number in the given slice of float64.
func MedianInts ¶
MedianInts gets the median number in the given slice of ints.
func StringToInt ¶
StringToInt takes a slice of string and returns a slice of int.
func ToInterface ¶ added in v1.1.32
func ToInterface[T any](in []T) []interface{}
func Unique ¶ added in v1.1.32
func Unique[T comparable](in []T) []T
func UniqueString ¶
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
}
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 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)
Click to show internal directories.
Click to hide internal directories.