eval

package
v0.0.0-...-006f1c9 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env map[Var]float64

对包含变量的表达式进行求值, 需要一个上下文(environment)来把变量映射到数值

type Expr

type Expr interface {
	// Eval返回表达式在env上下文下的值
	Eval(env Env) float64
	Check(vars map[Var]bool) error
}

func Parse

func Parse(input string) (_ Expr, err error)

type Var

type Var string

func (Var) Check

func (v Var) Check(vars map[Var]bool) error

func (Var) Eval

func (v Var) Eval(env Env) float64

Jump to

Keyboard shortcuts

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