Documentation ¶
Overview ¶
Package slices has several utilities for operating on slices given Go's lack of generic types. Many functions take an argument of type func(l, r T) bool, that's expected to compute l < r where T is T in []T, the type of the given slice.
Index ¶
- func FilterInPlace(sl interface{}, f interface{})
- func FromMapElems(m interface{}) interface{}
- func FromMapKeys(m interface{}) interface{}
- func HeapInterface(sl interface{}, less interface{}) heap.Interface
- func MakeInto(ptrTo interface{}, from interface{})
- func Map(f, input interface{}) interface{}
- func Sort(sl interface{}, less interface{}) interface{}
- func ToEmptyInterface(slice interface{}) (ret []interface{})
- type MapItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromMapElems ¶
func FromMapElems(m interface{}) interface{}
Returns all the elements []T, from m where m is map[K]T.
func FromMapKeys ¶
func FromMapKeys(m interface{}) interface{}
Returns all the elements []K, from m where m is map[K]T.
func HeapInterface ¶
Returns a "container/heap".Interface for the provided slice.
func MakeInto ¶
func MakeInto(ptrTo interface{}, from interface{})
Makes and sets a slice at *ptrTo, and type asserts all the elements from from to it.
func Sort ¶
func Sort(sl interface{}, less interface{}) interface{}
Sorts the slice in place. Returns sl for convenience.
func ToEmptyInterface ¶
func ToEmptyInterface(slice interface{}) (ret []interface{})
Returns a copy of all the elements of slice []T as a slice of interface{}.
Types ¶
Click to show internal directories.
Click to hide internal directories.