Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrInvalidSyntax ¶
ErrInvalidSyntax describes an invalid expression.
func (ErrInvalidSyntax) Error ¶
func (e ErrInvalidSyntax) Error() string
type ErrUnboundVars ¶
type ErrUnboundVars struct {
Missing []string
}
ErrUnboundVars is returned when an expression is missing variables.
func (ErrUnboundVars) Error ¶
func (e ErrUnboundVars) Error() string
type Expr ¶
type Expr struct {
// contains filtered or unexported fields
}
Expr is a compiled expression that can be reused serially.
func CompileExpr ¶
CompileExpr compiles the provided forumula into an Expr.
Example ¶
package main import ( "fmt" "github.com/ischneider/bittybox" ) func main() { expr, err := bittybox.CompileExpr("5 + y", "y") if err != nil { panic(err) } fmt.Println(expr.Evaluate([]float64{10})) }
Output: 15
Click to show internal directories.
Click to hide internal directories.