Documentation
¶
Index ¶
- func At[T any](values []T, at int) T
- func Eq[T comparable](a, b T) bool
- func Loc[T any](values []T, start int, end int) []T
- type Vec
- func (v *Vec[T]) Append(data ...T) *Vec[T]
- func (v *Vec[T]) At(index int) T
- func (v *Vec[T]) BinarySearch(target T, cmp func(a, b T) int) (pos int, ok bool)
- func (v *Vec[T]) Clone() *Vec[T]
- func (v *Vec[T]) Data() []T
- func (v *Vec[T]) Equal(other *Vec[T], eq func(a T, b T) bool) bool
- func (v *Vec[T]) Get(index int) T
- func (v *Vec[T]) IsSorted(cmp func(a T, b T) int) bool
- func (v *Vec[T]) Len() int
- func (v *Vec[T]) Loc(start, end int) *Vec[T]
- func (v *Vec[T]) Pipe(fn func(T) (T, bool)) *Vec[T]
- func (v *Vec[T]) Reduce(initial T, fn func(a, b T) T) T
- func (v *Vec[T]) Reverse() *Vec[T]
- func (v *Vec[T]) Seq() iter.Seq[T]
- func (v *Vec[T]) Set(i int, value T)
- func (v *Vec[T]) Slice(start, end int) *Vec[T]deprecated
- func (v *Vec[T]) Sort(cmp func(a T, b T) int) *Vec[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eq ¶
func Eq[T comparable](a, b T) bool
Types ¶
type Vec ¶
type Vec[T any] []T
Vec is simpler slice, mostly you don't need this.
Use *Vec instead of Vec
The zero value is hard to use thus...
func (*Vec[T]) At ¶
At is similar to Get but accept negative index. -1 will locate the last element.
func (*Vec[T]) BinarySearch ¶
BinarySearch searches for target in a sorted slice and returns the earliest position where target is found.
For more detail see: slices.BinarySearch
func (*Vec[T]) Equal ¶
Equal compare each element, and return true if all the same. use hs.Eq for convenience.
Click to show internal directories.
Click to hide internal directories.