canonical

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package canonical implements canonical expressions that can be compared to one another.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToValue

func ToValue(el any) *big.Float

ToValue returns a float value if the canonical expression is evaluable, that is if it contains only known values and no symbol.

Types

type Canonical

type Canonical interface {
	Comparable
	fmt.Stringer
}

Canonical is a canonical expression.

type Comparable

type Comparable interface {
	Compare(x Comparable) bool
}

Comparable defines an interface for comparing an expression against another.

type Evaluable

type Evaluable interface {
	// Float value of the expression.
	Float() *big.Float
}

Evaluable is a canonical that can be evaluated to a float.

type Simplifier

type Simplifier interface {
	Canonical
	Simplify() Simplifier
}

Simplifier is an expression that can be simplified.

func FromBinary

func FromBinary(op token.Token, x, y Canonical) Simplifier

FromBinary returns a canonical expression from a binary expression.

func NewExpr

func NewExpr(op token.Token, xs ...Canonical) Simplifier

NewExpr returns a new canonical expression using a prefixed form.

Jump to

Keyboard shortcuts

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