Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash returns a hash value for the given slice. If S satisfies the hash.Hasher interface then S's Hash method will be called.
func Index ¶
Index uses the given comparison function cmp to search for x in a slice S, and return the index, or -1 if not present. Assumes that the slice is sorted in increasing order as determined by cmp.
func Search ¶
Search uses the given comparison function cmp to search for x in a slice S, and return the index as specified by sort.Search. The return value is the index to insert x if x is not present (it could be S.Len()). Assumes that the slice is sorted in increasing order as determined by cmp.
func ToElementSlice ¶
ToElementSlice returns a copy of S as an []object.Element. If S satisfies the interface:
type ToElementSlicer interface { ToElementSlice() []object.Element // ToElementSlice returns a copy of the slice as an []object.Element. }
then S's ToElementSlice method will be called.
Types ¶
type ElementSlice ¶
ElementSlice wraps an []object.Element, implementing Interface.
func (ElementSlice) Entry ¶
func (S ElementSlice) Entry(i int) object.Element
Entry returns the i-th element in the slice. This will panic if i is out of range.
func (ElementSlice) Hash ¶
func (S ElementSlice) Hash() hash.Value
Hash returns a hash value for this slice.
func (ElementSlice) Slice ¶
func (S ElementSlice) Slice(k int, m int) Interface
Slice returns a subslice starting at index k and of length m - k. The returned subslice will be of the same underlying type. This will panic if the arguments are out of range.
func (ElementSlice) ToElementSlice ¶
func (S ElementSlice) ToElementSlice() []object.Element
ToElementSlice returns a copy of the slice as an []object.Element.
type GeneratorFunc ¶
GeneratorFunc is used to dynamically generate the i-th entry in a slice.
type Interface ¶
type Interface interface { Len() int // Len returns the length of the slice. Entry(i int) object.Element // Entry returns the i-th element in the slice. This will panic if i is out of range. }
Interface is a basic interface used to describe a slices of object.Elements.
func NewGenerator ¶
func NewGenerator(size int, f GeneratorFunc) (Interface, error)
NewGenerator returns a new dynamic slice of length "size" using the given generator function.
func ReverseSlice ¶
ReverseSlice wraps the slice S reversing the entries.
func Slice ¶
Slice returns a subslice of S starting at index k and of length m - k. This will panic if the arguments are out of range. If S satisfies the interface:
type Slicer interface { Slice(k int, m int) Interface // Slice returns a subslice starting at index k and of length m - k. The returned subslice will be of the same underlying type. This will panic if the arguments are out of range. }
then S's Slice method will be called.