Documentation ¶
Index ¶
- Constants
- func Templates() map[string][]string
- type ElementType
- type SliceSliceType
- type SliceType
- func (s SliceType) Abs() (out SliceType)
- func (s SliceType) All(f func(ElementType) bool) bool
- func (s SliceType) Any(f func(ElementType) bool) bool
- func (s SliceType) Average() float64
- func (s SliceType) Delete(e ElementType) (out SliceType)
- func (s SliceType) Filter(f func(ElementType) bool) (out SliceType)
- func (s SliceType) Foldl(z ElementType, f func(e1, e2 ElementType) ElementType) (out ElementType)
- func (s SliceType) Foldl1(f func(e1, e2 ElementType) ElementType) (out ElementType)
- func (s SliceType) Head() (out ElementType)
- func (s SliceType) Init() (out SliceType)
- func (s SliceType) Intercalate(ss SliceSliceType) (out SliceType)
- func (s SliceType) Intersperse(value ElementType) (out SliceType)
- func (s SliceType) Last() (out ElementType)
- func (s SliceType) Length() int
- func (s SliceType) Map(f func(ElementType) ElementType) (out SliceType)
- func (s SliceType) Maximum() (out ElementType)
- func (s SliceType) MaximumBy(f func(e1, e2 ElementType) ElementType) (max ElementType)
- func (s SliceType) Minimum() ElementType
- func (s SliceType) Modes() (out SliceType)
- func (s SliceType) Nub() (out SliceType)
- func (s SliceType) Null() bool
- func (s SliceType) Product() ElementType
- func (s SliceType) Reverse() (out SliceType)
- func (s SliceType) Sort() SliceType
- func (s SliceType) Sum() ElementType
- func (s SliceType) Tail() (out SliceType)
- func (s SliceType) Take(n uint64) (out SliceType)
- func (s SliceType) Uncons() (head ElementType, tail SliceType)
- func (s SliceType) Unlines() (out string)
- func (s SliceType) Unwords() (out string)
- type Symbol
- type Template
Constants ¶
const ( ForNumbers = "ForNumbers" ForStrings = "ForStrings" ForStructs = "ForStructs" )
Types for which the function can be generated
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SliceType ¶
type SliceType []ElementType
SliceType represents a 1D slice.
func (SliceType) Abs ¶
Abs returns the absolute value of all elements in the slice. Can be generated for number-types.
func (SliceType) All ¶
func (s SliceType) All(f func(ElementType) bool) bool
All returns true if all elements of the slice satisfy the predicate. Can be generated for any type.
func (SliceType) Any ¶
func (s SliceType) Any(f func(ElementType) bool) bool
Any returns true if any of the elements satisfy the predicate. Can be generated for any type.
func (SliceType) Average ¶
Average returns the average of all elements in the slice. Can be generated for all number types.
func (SliceType) Delete ¶
func (s SliceType) Delete(e ElementType) (out SliceType)
Delete returns a slice with the first matching element removed from the slice. Can be generated for any type.
func (SliceType) Filter ¶
func (s SliceType) Filter(f func(ElementType) bool) (out SliceType)
Filter returns a slice containing only the elements that match the predicate. Can be generated for any type.
func (SliceType) Foldl ¶
func (s SliceType) Foldl(z ElementType, f func(e1, e2 ElementType) ElementType) (out ElementType)
Foldr reduces a list by iteratively applying f from left->right. Thus, for an empty slice, the result is the default zero-value.
func (SliceType) Foldl1 ¶
func (s SliceType) Foldl1(f func(e1, e2 ElementType) ElementType) (out ElementType)
Foldr reduces a list by iteratively applying f from left->right. Thus, for an empty slice, the result is the default zero-value.
func (SliceType) Head ¶
func (s SliceType) Head() (out ElementType)
Head returns the first element in the slice. If no element is found, returns the zero-value of the type. Can be generated for any type.
func (SliceType) Init ¶
Init takes n-1 elements from a slice, where n = len(list). Can be generated for any type.
func (SliceType) Intercalate ¶
func (s SliceType) Intercalate(ss SliceSliceType) (out SliceType)
Intercalate inserts the method receiver slice into the function slice at each step. Can be generated for any type.
func (SliceType) Intersperse ¶
func (s SliceType) Intersperse(value ElementType) (out SliceType)
Intersperse inserts the receiving value between each element of the method receiver. Can be generated for any type.
func (SliceType) Last ¶
func (s SliceType) Last() (out ElementType)
Last returns the last element in the slice If no element is found, returns the zero-value of the type Can be generated for any type.
func (SliceType) Length ¶
Length returns the length (len) of a slice. Can be generated for any type.
func (SliceType) Map ¶
func (s SliceType) Map(f func(ElementType) ElementType) (out SliceType)
Map return a new slice with the map operation applied to each element. Can be generated for any type.
func (SliceType) Maximum ¶
func (s SliceType) Maximum() (out ElementType)
Maximum returns the maximum in a slice. Can be generated for number types.
func (SliceType) MaximumBy ¶
func (s SliceType) MaximumBy(f func(e1, e2 ElementType) ElementType) (max ElementType)
MaximumBy returns the maximum elements according to a custom comparator. Can be generated for any type.
func (SliceType) Minimum ¶
func (s SliceType) Minimum() ElementType
Minimum returns the minimum of a slice. Can be generated for number types.
func (SliceType) Modes ¶
Modes returns the elements with highest frequency in the slice. Can be generated for any type.
func (SliceType) Nub ¶
Nub returns a slice containing only the unique elements of the receiver. The order of the elements is preserved. Can be generated for any type.
func (SliceType) Product ¶
func (s SliceType) Product() ElementType
Product returns the product of all elements in the slice. Can be generated for any number type.
func (SliceType) Sum ¶
func (s SliceType) Sum() ElementType
Sum returns the sum of all elements in the slice. Can be generated for any number type.
func (SliceType) Tail ¶
Tail takes [1 -> n] elements from a slice, where n = len(list) Returns an empty slice if there are less than 2 elements in slice Can be generated for any type.
func (SliceType) Take ¶
Take takes the first n elements of the slice, or the entire slice if n > len(slice). Can be generated for any type.
func (SliceType) Uncons ¶
func (s SliceType) Uncons() (head ElementType, tail SliceType)
Uncons decomposes a slice into the head and tail component. Can be generated for any type.