functions

package
v0.0.0-...-25cfde2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ForNumbers = "ForNumbers"
	ForStrings = "ForStrings"
	ForStructs = "ForStructs"
)

Types for which the function can be generated

Variables

This section is empty.

Functions

func Templates

func Templates() map[string][]string

Templates returns all entries in the template map

Types

type ElementType

type ElementType float64

ElementType represents a single entry in a slice.

type SliceSliceType

type SliceSliceType [][]ElementType

SliceSliceType represents a 2D slice.

type SliceType

type SliceType []ElementType

SliceType represents a 1D slice.

func (SliceType) Abs

func (s SliceType) Abs() (out SliceType)

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

func (s SliceType) Average() float64

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

func (s SliceType) Init() (out SliceType)

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

func (s SliceType) Length() int

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

func (s SliceType) Modes() (out SliceType)

Modes returns the elements with highest frequency in the slice. Can be generated for any type.

func (SliceType) Nub

func (s SliceType) Nub() (out SliceType)

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) Null

func (s SliceType) Null() bool

Null returns true the slice is empty. 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) Reverse

func (s SliceType) Reverse() (out SliceType)

Reverse returns the reversed slice. Can be generated for any type.

func (SliceType) Sort

func (s SliceType) Sort() SliceType

Sort is a wrapper around go sort function. Can be generated for any 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

func (s SliceType) Tail() (out SliceType)

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

func (s SliceType) Take(n uint64) (out SliceType)

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.

func (SliceType) Unlines

func (s SliceType) Unlines() (out string)

Unlines joins together the string representation of the slice with newlines after each element. Can be generated for any type.

func (SliceType) Unwords

func (s SliceType) Unwords() (out string)

Unwords joins together the string representation of the slice with newlines after each element. Can be generated for any type.

type Symbol

type Symbol interface {
	Symbol()
}

Symbol is represents a data token to be parsed.

type Template

type Template string

Template is the content of a function file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL