postfix

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 4 Imported by: 0

README

postfix

-- import "github.com/darylnwk/postfix"

Usage

func Evaluate
func Evaluate(postfix Postfix, variables map[string]float64) float64

Evaluate takes Postfix and a map of variables and returns the result of the expression See https://en.wikipedia.org/wiki/Reverse_Polish_notation#Postfix_evaluation_algorithm for more details.

type Postfix
type Postfix []mathtoken.Token

Postfix defines a list of tokens

func ParseInfix
func ParseInfix(infix string) (postfix Postfix, err error)

ParseInfix parses a mathematical expression in infix notation to postfix notation (or RPN) using Shunting-yard algorithm. See https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(postfix Postfix, variables map[string]float64) float64

Evaluate takes `Postfix` and a map of variables and returns the result of the expression See https://en.wikipedia.org/wiki/Reverse_Polish_notation#Postfix_evaluation_algorithm for more details.

Types

type Postfix

type Postfix []mathtoken.Token

Postfix defines a list of tokens

func ParseInfix

func ParseInfix(infix string) (postfix Postfix, err error)

ParseInfix parses a mathematical expression in infix notation to postfix notation (or RPN) using Shunting-yard algorithm. See https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail for more details.

Jump to

Keyboard shortcuts

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