Documentation ¶
Overview ¶
Package goji provides functional utils for int / float / string Slice.
Index ¶
- func Concat()
- func Difference(lenI, lenJ int, comparator func(int, int) bool, handlers ...func(...int)) []int
- func Every(n int, predict func(int) bool) bool
- func Fill(fill func(int), n int, startEndIndex ...int)
- func Filter(n int, predict func(int) bool, handlers ...func(...int)) []int
- func FindIndex(n int, testing func(int) bool, fromIndex ...int) int
- func FindLastIndex(n int, testing func(int) bool, fromIndex ...int) int
- func Includes(n int, comp func(int) bool) bool
- func Intersection(lenI, lenJ int, comparator func(int, int) bool, handlers ...func(...int)) []int
- func Join(join func(int) string, n int, sep ...string) string
- func Map(n int, m func(int))
- func Max(x, y int) int
- func Min(x, y int) int
- func Range(end int) []struct{}
- func Reverse(n int, swap func(int, int))
- func Shuffle(n int, swap func(int, int))
- func Slice(slice func(int, int), n int, startEndIndex ...int)
- func Some(n int, predict func(int) bool) bool
- func Sort(n int, swap func(int, int), less func(int, int) bool)
- type Sorter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶
Difference returns difference of array/slice I's values not included in the other given array J. lenI, lenJ is the length of array/slice I, J. comparator compares values from array/slice I, J.
func Every ¶
Every tests whether all elements pass the test implemented by predict. n is the number of elements. j is the index of array/slice.
func Fill ¶
Fill fills all elements from a start index to an end index with a static value. the end index is not included. n is the number of elements. start and end index are optional, default to zero and n.
func Filter ¶
Filter filters elements, n is the number of elements. predict check element with index i and returns true or false. handlers receive accumulated indexes idx from predict, if any.
func FindIndex ¶
FindIndex returns the index of the first element that satisfies the provided testing function. Otherwise -1 is returned. n is the number of elements.
func FindLastIndex ¶
FindLastIndex iterates over elements from right to left.
func Includes ¶
Includes determines whether an array/slice includes a certain element, returning true or false. n is the number of elements. comp determines whether the given element with index j is found.
func Intersection ¶
Intersection returns values that are included in both given array/slice.
func Join ¶
Join joins all elements of array/slice into a string. The separator string sep is placed between elements in the resulting string. n is the number of elements. func join receive element index i and return a string.
func Map ¶
Map calls a provided function m on every element. n is the number of elements. m map element with index i.
func Range ¶
func Range(end int) []struct{}
Range creates a range of numbers progressing from zero up to, but not including end.
func Reverse ¶
Reverse reverses an array/slice, n is the number of elements. swap swaps the elements with indexes i and j.
func Shuffle ¶
Shuffle randomizes the order of elements. n is the number of elements. swap swaps the elements with indexes i and j.
func Slice ¶
Slice returns a portion of array/slice selected from start to end (end not included). n is the number of elements. start and end indexes are optional, default to zero and n. start and end indexes are passed to slice func.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
example
|
|
pkg
|
|
float32util
Package float32util provides functional utils for float.
|
Package float32util provides functional utils for float. |
intutil
Package intutil provides functional utils for int.
|
Package intutil provides functional utils for int. |
strutil
Package strutil provides functional utils for string.
|
Package strutil provides functional utils for string. |