functions

package module
v0.0.0-...-ea2659f Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 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) Break

func (s SliceType) Break(f func(ElementType) bool) (before SliceType, after SliceType)

Break returns a tuple of any elements that do not satisfy the predicate up until the first time it passes, followed by the rest of the elements. Can be generated on any type.

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

func (s SliceType) Drop(i int) (out SliceType)

Drop returns a new Slice with the elements after the provided key. Can be generated for any type.

func (SliceType) DropWhile

func (s SliceType) DropWhile(f func(ElementType) bool) (out SliceType)

DropWhile returns a new slice containing all elements after the predicate fails for the first time. Can be generated for any type.

func (SliceType) Elem

func (s SliceType) Elem(el ElementType) bool

Elem returns true if the slice contains the element 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)

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

Foldl1 reduces a list by iteratively applying f from left->right. Thus, for an empty slice, the result is the default zero-value.

func (SliceType) Foldr

func (s SliceType) Foldr(e ElementType, f func(e1, e2 ElementType) ElementType) (out ElementType)

Foldr reduces a list by iteratively applying f from right -> left. Thus, for an empty slice, the result is the default zero-value.

func (SliceType) Foldr1

func (s SliceType) Foldr1(f func(e1, e2 ElementType) ElementType) (out ElementType)

Foldr1 reduces a list by iteratively applying f from right -> left. Thus, for an empty slice, the result is the default zero-value.

func (SliceType) Group

func (s SliceType) Group() (out SliceSliceType)

Group returns a list of lists where each list contains only equal elements and the concatenation of the result is equal to the argument. Can be generated for any type.

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

func (s SliceType) Inits() (out SliceSliceType)

Inits returns all inits of a sequence, in order of small to large, as if it were called recursively. 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) IsPrefixOf

func (s SliceType) IsPrefixOf(in SliceType) bool

IsPrefixOf returns true if the current sliceType is a prefix of the passed one. Can be generated for any time.

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

func (s SliceType) Scanl(e ElementType, f func(e1, e2 ElementType) ElementType) (out SliceType)

Scanl reduces a list by iteratively applying f from left->right and then returns each iteration in a slice.

func (SliceType) Sort

func (s SliceType) Sort() SliceType

Sort is a wrapper around go sort function. Can be generated for any type.

func (SliceType) Span

func (s SliceType) Span(f func(ElementType) bool) (before SliceType, after SliceType)

Span returns a tuple of any elements that satisfy the predicate up until the first failure, followed by the rest of the elements. Can be generated for any type.

func (SliceType) SplitAt

func (s SliceType) SplitAt(i int) (before, after SliceType)

SplitAt splits the slice at the given index, returning before and after as a tuple. 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) Tails

func (s SliceType) Tails() (out SliceSliceType)

Tails returns all tails of a sequence, in order of large to small, as if it were called recursively. 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) TakeWhile

func (s SliceType) TakeWhile(p func(ElementType) bool) (out SliceType)

TakeWhile continues appending to the output as long as the predicate is satisfied. 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