Documentation
¶
Overview ¶
Package perseus is golang util operation
Index ¶
- func Cut[K any, V constraints.Integer](slice []K, i, j V) []K
- func Extend[T any](A, B []T) []T
- func Insert[K any, V constraints.Integer](slice []K, element K, position V) []K
- func InsertVector[K any, V constraints.Integer](origin, insert []K, position V) []K
- func Pop[T any](slice []T) (T, []T)
- func Prepend[T any](sep T, i []T) []T
- func Remove[K any, V constraints.Integer](slice []K, sep V) []K
- func Repeat[T any](count int, v ...T) []T
- func Shift[T any](slice []T) (T, []T)
- func Sum[T Number](values []T) T
- func WithIndex[K comparable, V any](m map[K]V) iter.Seq[KeyValueIndex[K, V]]
- type KeyValueIndex
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cut ¶
func Cut[K any, V constraints.Integer](slice []K, i, j V) []K
Cut Delete from i to j from the slice
func Insert ¶
func Insert[K any, V constraints.Integer](slice []K, element K, position V) []K
Insert Insert element to specified position
func InsertVector ¶
func InsertVector[K any, V constraints.Integer](origin, insert []K, position V) []K
InsertVector Insert slice to specified position
func Pop ¶
func Pop[T any](slice []T) (T, []T)
Pop returns the last element of slice and other element's slice.
func Prepend ¶
func Prepend[T any](sep T, i []T) []T
Prepend add an element to the beginning of a slice.
func Remove ¶
func Remove[K any, V constraints.Integer](slice []K, sep V) []K
Remove Remove specified element from slice
func Shift ¶
func Shift[T any](slice []T) (T, []T)
Shift returns the first element of slice and other element's slice.
func WithIndex ¶
func WithIndex[K comparable, V any](m map[K]V) iter.Seq[KeyValueIndex[K, V]]
Types ¶
type KeyValueIndex ¶
type KeyValueIndex[K comparable, V any] struct { Index int Key K Value V }
type Number ¶
type Number interface {
constraints.Integer | constraints.Float
}
Click to show internal directories.
Click to hide internal directories.