Documentation ¶
Index ¶
- func Dedupe[S ~[]E, E comparable](s S) S
- func MakeMatrix2D[E any](n, m int) [][]E
- func MatrixGetOneOrDefault[C comparable](m [][]C, keyIdx uint, keyValue C, wantIdx uint, defaultValue C) C
- func NewWithDefault[E any](size uint, d E) []E
- func Reverse[E comparable](s []E)
- func Split[S ~[]E, E comparable](s S, n uint) []S
- func Sub[S ~[]E, E comparable](s, t S) S
- func SubRegexpString(s []string, r *regexp.Regexp) []string
- func ToMatrix[S ~[]E, E comparable](s S) []S
- func UniqueValues[S ~[]E, E comparable](s S) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dedupe ¶
func Dedupe[S ~[]E, E comparable](s S) S
Dedupe returns a string slice with duplicate values removed. First observance is kept.
func MakeMatrix2D ¶ added in v0.44.0
MakeMatrix2D returns a 2-dimensional matrix. Usage as follows `a := Make2D[uint8](dy, dx)`. Sourced from: https://stackoverflow.com/a/71781206/1908967
func MatrixGetOneOrDefault ¶ added in v0.47.0
func MatrixGetOneOrDefault[C comparable](m [][]C, keyIdx uint, keyValue C, wantIdx uint, defaultValue C) C
func NewWithDefault ¶ added in v0.48.0
NewWithDefault creates a slice of length `size` which values populated by default value `d`.
func Reverse ¶ added in v0.45.0
func Reverse[E comparable](s []E)
Reverse reverses the order of a slice.
func Split ¶ added in v0.47.0
func Split[S ~[]E, E comparable](s S, n uint) []S
Split will split a slice into a slice of slices where each slice ha a max size `n`.
func Sub ¶ added in v0.45.0
func Sub[S ~[]E, E comparable](s, t S) S
Sub returns a string slice with duplicate values removed. First observance is kept.
func SubRegexpString ¶ added in v0.45.0
Sub returns a string slice with duplicate values removed. First observance is kept.
func ToMatrix ¶ added in v0.47.0
func ToMatrix[S ~[]E, E comparable](s S) []S
func UniqueValues ¶ added in v0.47.0
func UniqueValues[S ~[]E, E comparable](s S) bool
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.