atoms

package
v0.0.0-...-251a8ae Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FoldFnAdd designates that values should be added.
	FoldFnAdd foldFn = iota
	// FoldFnMul designates that values should be multiplied.
	FoldFnMul
)

Variables

This section is empty.

Functions

func AttrsToStrings

func AttrsToStrings(sym *expreduceapi.Attributes) []string

func ComputeNumericPart

func ComputeNumericPart(fn foldFn, e expreduceapi.ExpressionInterface) (expreduceapi.Ex, int)

func ContainsSymbol

func ContainsSymbol(e expreduceapi.Ex, name string) bool

func ExOrder

func ExOrder(a expreduceapi.Ex, b expreduceapi.Ex) int64

func IsSameQ

func IsSameQ(a expreduceapi.Ex, b expreduceapi.Ex) bool

IsSameQ returns if two expressions are the same. It is mostly just a comparison of the hash values but it does include special handling for floats.

func NumberQ

func NumberQ(e expreduceapi.Ex) bool

func OperatorAssertion

func OperatorAssertion(ex expreduceapi.Ex, opHead string) (*Expression, *Expression, bool)

func RegisterGobAtoms

func RegisterGobAtoms()

RegisterGobAtoms performs gob registration for the atoms package.

func S

func S(name string) expreduceapi.Ex

func StringsToAttributes

func StringsToAttributes(strings []string) expreduceapi.Attributes

Types

type Complex

type Complex struct {
	Re expreduceapi.Ex
	Im expreduceapi.Ex
	// contains filtered or unexported fields
}

func NewComplex

func NewComplex(r expreduceapi.Ex, i expreduceapi.Ex) *Complex

func (*Complex) AsExpr

func (cmplx *Complex) AsExpr() expreduceapi.Ex

func (*Complex) Copy

func (cmplx *Complex) Copy() expreduceapi.Ex

func (*Complex) DeepCopy

func (cmplx *Complex) DeepCopy() expreduceapi.Ex

func (*Complex) HasReal

func (cmplx *Complex) HasReal() bool

func (*Complex) Hash

func (cmplx *Complex) Hash() uint64

func (*Complex) IsEqual

func (cmplx *Complex) IsEqual(other expreduceapi.Ex) string

func (*Complex) NeedsEval

func (cmplx *Complex) NeedsEval() bool

func (*Complex) SetNeedsEval

func (cmplx *Complex) SetNeedsEval(newVal bool)

func (*Complex) StringForm

func (cmplx *Complex) StringForm(p expreduceapi.ToStringParams) string

type Expression

type Expression struct {
	Parts []expreduceapi.Ex

	EvaledHash uint64
	CachedHash uint64
	// contains filtered or unexported fields
}

func E

func E(parts ...expreduceapi.Ex) *Expression

func HeadAssertion

func HeadAssertion(ex expreduceapi.Ex, head string) (*Expression, bool)

HeadAssertion checks if the Ex is an Expression of with a head of 'head'. Deprecated in favor of headExAssertion

func NewEmptyExpression

func NewEmptyExpression() *Expression

func NewExpression

func NewExpression(parts []expreduceapi.Ex) *Expression

func NewHead

func NewHead(head string) *Expression

func NewStringList

func NewStringList(items []string) *Expression

NewStringList transforms a list of strings in Go format into Expreduce format.

func ShallowCopy

func ShallowCopy(thisExprExprInt expreduceapi.ExpressionInterface) *Expression

func (*Expression) AppendEx

func (thisExpr *Expression) AppendEx(e expreduceapi.Ex)

func (*Expression) AppendExArray

func (thisExpr *Expression) AppendExArray(e []expreduceapi.Ex)

func (*Expression) ClearHashes

func (thisExpr *Expression) ClearHashes()

func (*Expression) Copy

func (thisExpr *Expression) Copy() expreduceapi.Ex

func (*Expression) DeepCopy

func (thisExpr *Expression) DeepCopy() expreduceapi.Ex

func (*Expression) GetPart

func (thisExpr *Expression) GetPart(i int) expreduceapi.Ex

func (*Expression) GetParts

func (thisExpr *Expression) GetParts() []expreduceapi.Ex

func (*Expression) Hash

func (thisExpr *Expression) Hash() uint64

func (*Expression) HeadStr

func (thisExpr *Expression) HeadStr() string

func (*Expression) IsEqual

func (thisExpr *Expression) IsEqual(otherEx expreduceapi.Ex) string

func (*Expression) Len

func (thisExpr *Expression) Len() int

Implement the sort.Interface

func (*Expression) Less

func (thisExpr *Expression) Less(i, j int) bool

func (*Expression) NeedsEval

func (thisExpr *Expression) NeedsEval() bool

func (*Expression) PropagateConditionals

func (thisExpr *Expression) PropagateConditionals() (*Expression, bool)

func (*Expression) SetNeedsEval

func (thisExpr *Expression) SetNeedsEval(newVal bool)

func (*Expression) SetParts

func (thisExpr *Expression) SetParts(newParts []expreduceapi.Ex)

func (*Expression) String

func (thisExpr *Expression) String() string

func (*Expression) StringForm

func (thisExpr *Expression) StringForm(params expreduceapi.ToStringParams) string

func (*Expression) Swap

func (thisExpr *Expression) Swap(i, j int)

type Flt

type Flt struct {
	Val *big.Float
}

Flt represents a floating point number in Expreduce. The values are represented by big.Float internally.

func IntegerToFlt

func IntegerToFlt(i *Integer) (*Flt, bool)

func NewReal

func NewReal(v *big.Float) *Flt

func RationalToFlt

func RationalToFlt(r *Rational) (*Flt, bool)

func (*Flt) Copy

func (flt *Flt) Copy() expreduceapi.Ex

func (*Flt) DeepCopy

func (flt *Flt) DeepCopy() expreduceapi.Ex

func (*Flt) Hash

func (flt *Flt) Hash() uint64

func (*Flt) IsEqual

func (flt *Flt) IsEqual(other expreduceapi.Ex) string

func (*Flt) NeedsEval

func (flt *Flt) NeedsEval() bool

func (*Flt) StringForm

func (flt *Flt) StringForm(params expreduceapi.ToStringParams) string

type Integer

type Integer struct {
	Val *big.Int
	// contains filtered or unexported fields
}

Integer numbers represented by big.Int

func NewInt

func NewInt(i int64) *Integer

func NewInteger

func NewInteger(i *big.Int) *Integer

func (*Integer) Copy

func (thisInt *Integer) Copy() expreduceapi.Ex

func (*Integer) DeepCopy

func (thisInt *Integer) DeepCopy() expreduceapi.Ex

func (*Integer) Hash

func (thisInt *Integer) Hash() uint64

func (*Integer) IsEqual

func (thisInt *Integer) IsEqual(other expreduceapi.Ex) string

func (*Integer) NeedsEval

func (thisInt *Integer) NeedsEval() bool

func (*Integer) String

func (thisInt *Integer) String() string

func (*Integer) StringForm

func (thisInt *Integer) StringForm(params expreduceapi.ToStringParams) string

type Rational

type Rational struct {
	Num *big.Int
	Den *big.Int
	// contains filtered or unexported fields
}

func NewRational

func NewRational(n *big.Int, d *big.Int) *Rational

func (*Rational) Copy

func (thisRational *Rational) Copy() expreduceapi.Ex

func (*Rational) DeepCopy

func (thisRational *Rational) DeepCopy() expreduceapi.Ex

func (*Rational) Hash

func (thisRational *Rational) Hash() uint64

func (*Rational) IsEqual

func (thisRational *Rational) IsEqual(other expreduceapi.Ex) string

func (*Rational) MulBigI

func (thisRational *Rational) MulBigI(i *big.Int)

func (*Rational) NeedsEval

func (thisRational *Rational) NeedsEval() bool

func (*Rational) SetNeedsEval

func (thisRational *Rational) SetNeedsEval(newVal bool)

func (*Rational) StringForm

func (thisRational *Rational) StringForm(params expreduceapi.ToStringParams) string

type String

type String struct {
	Val string
}

func NewString

func NewString(v string) *String

func (*String) Copy

func (str *String) Copy() expreduceapi.Ex

func (*String) DeepCopy

func (str *String) DeepCopy() expreduceapi.Ex

func (*String) GetValue

func (str *String) GetValue() string

func (*String) Hash

func (str *String) Hash() uint64

func (*String) IsEqual

func (str *String) IsEqual(other expreduceapi.Ex) string

func (*String) NeedsEval

func (str *String) NeedsEval() bool

func (*String) String

func (str *String) String() string

func (*String) StringForm

func (str *String) StringForm(params expreduceapi.ToStringParams) string

type Symbol

type Symbol struct {
	Name string
	// contains filtered or unexported fields
}

Symbol represents a symbol in Expreduce. Symbols are defined by a string-based name.

func NewSymbol

func NewSymbol(name string) *Symbol

func (*Symbol) Attrs

func (*Symbol) Copy

func (sym *Symbol) Copy() expreduceapi.Ex

func (*Symbol) DeepCopy

func (sym *Symbol) DeepCopy() expreduceapi.Ex

func (*Symbol) Default

func (sym *Symbol) Default(dm expreduceapi.DefinitionMap) expreduceapi.Ex

func (*Symbol) Hash

func (sym *Symbol) Hash() uint64

func (*Symbol) IsEqual

func (sym *Symbol) IsEqual(other expreduceapi.Ex) string

func (*Symbol) NeedsEval

func (sym *Symbol) NeedsEval() bool

func (*Symbol) String

func (sym *Symbol) String() string

func (*Symbol) StringForm

func (sym *Symbol) StringForm(params expreduceapi.ToStringParams) string

Jump to

Keyboard shortcuts

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