Documentation ¶
Index ¶
- func WithFunctions(funcs Functions) treeOption
- func WithVariables(vars Variables) treeOption
- type Function
- type FunctionalValue
- type Functions
- type Number
- func (n Number) Add(other Value) Value
- func (n Number) Cos() Number
- func (n Number) Divide(other Value) Value
- func (n Number) Equal(other Number) bool
- func (n Number) Factorial() Number
- func (n Number) Floor() Number
- func (n Number) LShift(other Value) Value
- func (n Number) Mod(other Value) Value
- func (n Number) Multiply(other Value) Value
- func (n Number) Neg() Number
- func (n Number) Number() Number
- func (n Number) PowerOf(other Value) Value
- func (n Number) RShift(other Value) Value
- func (n Number) Sin() Number
- func (n Number) Sqrt() Number
- func (n Number) String() string
- func (n Number) Sub(other Value) Value
- func (n Number) Tan() Number
- func (n Number) Trunc(precision int32) Number
- type Numberer
- type Operator
- type String
- func (s String) Add(other Value) Value
- func (s String) Divide(other Value) Value
- func (s String) Equal(other String) bool
- func (s String) LShift(Value) Value
- func (s String) Mod(Value) Value
- func (s String) Multiply(other Value) Value
- func (s String) Number() Number
- func (s String) PowerOf(Value) Value
- func (s String) RShift(Value) Value
- func (s String) String() string
- func (s String) Sub(other Value) Value
- type Stringer
- type Tree
- type TreeBuilder
- type Undefined
- func (Undefined) Add(Value) Value
- func (Undefined) Divide(Value) Value
- func (u Undefined) Equal(other Undefined) bool
- func (Undefined) LShift(Value) Value
- func (Undefined) Mod(Value) Value
- func (Undefined) Multiply(Value) Value
- func (Undefined) PowerOf(Value) Value
- func (Undefined) RShift(Value) Value
- func (u Undefined) String() string
- func (Undefined) Sub(Value) Value
- type Value
- type Variable
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithFunctions ¶
func WithFunctions(funcs Functions) treeOption
func WithVariables ¶
func WithVariables(vars Variables) treeOption
Types ¶
type Function ¶
type Function struct { Name string BodyFn FunctionalValue Args []Tree }
func NewFunction ¶
func NewFunction(name string, bodyFn FunctionalValue, args ...Tree) Function
type FunctionalValue ¶
func PreDefinedFunction ¶
func PreDefinedFunction(name string) FunctionalValue
PreDefinedFunction returns a pre-defined function body if known. It returns `nil` when no pre-defined function exists by the specified name. This signals the Evaluator to attempt to find a user defined function.
func UserDefinedFunction ¶
func UserDefinedFunction(name string, userFunctions Functions) FunctionalValue
func (FunctionalValue) String ¶
func (fv FunctionalValue) String() string
type Functions ¶
type Functions map[string]FunctionalValue
func (Functions) Function ¶
func (f Functions) Function(name string) FunctionalValue
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
func NewNumberFromFloat ¶
func NewNumberFromString ¶
type Tree ¶
type Tree []entry
func Parse ¶
Example: Parse("blah").Eval(WithVariables(...), WithFunctions(...)) This allows to parse an expression and then use the resulting Tree for multiple evaluations with different variables provided.
type TreeBuilder ¶
type TreeBuilder struct{}
func NewTreeBuilder ¶
func NewTreeBuilder() *TreeBuilder
type Undefined ¶
type Undefined struct {
// contains filtered or unexported fields
}
func NewUndefined ¶
func NewUndefined() Undefined
func NewUndefinedWithReasonf ¶
type Value ¶
Click to show internal directories.
Click to hide internal directories.