Documentation
¶
Index ¶
- func Abs(x int) int
- func After(value string, a string) string
- func AfterSpace(value string) string
- func Before(value string, a string) string
- func BeforeSpace(value string) string
- func ContainsInt(lst []int, x int) bool
- func CountLines(filename string) (int, error)
- func DeserializeFromFile(filename string, obj interface{}) (err error)
- func ForEachField(i interface{}, ...)
- func GetNeighborsIndices(size, index, windowSize int) []int
- func IsStruct(i interface{}) bool
- func MakeIndices(size int) []int
- func MakeIntMatrix(rows, cols int) [][]int
- func MinInt(a, b int) int
- func Name(i interface{}) string
- func ReverseInPlace(s interface{})
- func ReverseIntSlice(lst []int) []int
- func ReverseString(text string) string
- func SerializeToFile(filename string, obj interface{}) (err error)
- func SplitByRune(str string) []string
- func SumInt(v []int) (s int)
- func TypeName(instance interface{}) string
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterSpace ¶
AfterSpace returns the substring from value which comes after the first whitespace.
func BeforeSpace ¶
BeforeSpace returns the substring from value which comes before the first whitespace.
func ContainsInt ¶
ContainsInt returns whether the list contains the x-element, or not.
func CountLines ¶
CountLines efficiently counts the lines of text inside a file. See: https://stackoverflow.com/questions/24562942/golang-how-do-i-determine-the-number-of-lines-in-a-file-efficiently
func DeserializeFromFile ¶
DeserializeFromFile deserializes obj from file, using gob decoding.
func ForEachField ¶
func ForEachField(i interface{}, callback func(field interface{}, name string, tag reflect.StructTag))
ForEachField calls the callback for each field of the struct i.
func GetNeighborsIndices ¶
GetNeighborsIndices returns the indices of the (circular) neighbours at position index.
func MakeIndices ¶
MakeIndices returns a slice of the given size, where each element has the same value of its own index position.
func MakeIntMatrix ¶
MakeIntMatrix returns a new 2-dimensional slice of int.
func ReverseInPlace ¶
func ReverseInPlace(s interface{})
ReverseInPlace reverses the elements of s (usually a slice).
func ReverseIntSlice ¶
ReverseIntSlice returns a reversed version of the given slice.
func ReverseString ¶
ReverseString reverses the given string.
func SerializeToFile ¶
SerializeToFile serializes obj to file, using gob encoding.
func SplitByRune ¶
SplitByRune splits the input string by runes, and produces a new slice of string, where each item is one rune converted to string.
Types ¶
type Pool ¶
type Pool struct { // New optionally specifies a function to generate // a value when Get would otherwise return nil. New func() interface{} // contains filtered or unexported fields }
Pool is a naive implementation of a pool, based on broadcast channel. You can use this pool in the same way you use sync.Pool.
func NewPool ¶
NewPool returns a new pool ready to use. The pool can contain up to a max number of items. Set the property New to generate new items when needed during the Get.