Enum poi::Symbol

source ·
pub enum Symbol {
Show 144 variants Custom(Arc<String>), Any, Var(Arc<String>), ArityVar(Arc<String>, usize), ListVar(Arc<String>), Singleton(Arc<String>), HeadTailTup(Box<Expr>, Box<Expr>), HeadTailList(Box<Expr>, Box<Expr>), RetVar(Arc<String>), RetIntVar(Arc<String>), RetPosVar(Arc<String>), RetStrictPosVar(Arc<String>), RetNegVar(Arc<String>), NotRetVar(Arc<String>), NotInVarName(Arc<String>, Arc<String>), BinopRetVar(Arc<String>, Arc<String>, Box<Symbol>), TernopRetVar(Arc<String>, Arc<String>, Arc<String>, Box<Symbol>), UnopRetVar(Arc<String>, Box<Symbol>), NoConstrVar(Arc<String>), NoSubstVar(Arc<String>), Dup, False1, Not, Idb, True1, False2, True2, And, Or, Eqb, Xor, Nand, Nor, Exc, Imply, Fstb, Sndb, Even, Odd, Abs, Lt, Rlt, Le, Rle, Gt, Rgt, Ge, Rge, Neg, Inc, Reci, Conj, Norm, Sqnorm, Add, Sub, Rsub, Mul, Mulc, Div, Rdiv, Rem, Pow, Rpow, Sqrt, Ln, Log2, Log10, Exp, Len, Concat, Sum, Min2, Max2, Min, Max, ArgMax, ArgMin, SoftMax, SoftMin, SoftArgMax, SoftArgMin, Range, Rangel, Ranger, Rangem, Prob, Probl, Probr, Probm, MulMat, Col, Det, Dim, Transpose, IsSquareMat, Base, Fst, Snd, Sin, Asin, Cos, Acos, Tan, Atan, Atan2, Dot, Push, PushFront, Item, El, Re, Im, Id, Eq, Neq, Inv, Deriv, Integ, Pariv, If, Ex, Triv, AnyType, RetType, VecType, Rty, VecOp, VecUop, Arity, Pi, Tau, Eps, Imag, Imag2, Imag3, TypeOf, BoolType, F64Type, QuatType, Inf, Both, Neither, Subst,
}
Expand description

Contains symbols and operators on symbols.

Variants§

§

Custom(Arc<String>)

A custom symbol.

§

Any

The wildcard symbol _.

§

Var(Arc<String>)

A variable bound from context.

This can be anything.

§

ArityVar(Arc<String>, usize)

A function variable with specified arity (number of arguments).

§

ListVar(Arc<String>)

A list variable.

§

Singleton(Arc<String>)

A list variable of length 1.

Lifts the value out of the list at binding.

§

HeadTailTup(Box<Expr>, Box<Expr>)

A head-tail pattern match on a tuple.

This requires the tuple to have at least length 2. It is to avoid cycles between reductions.

§

HeadTailList(Box<Expr>, Box<Expr>)

A head-tail pattern match on a list.

This requires the list to have at least length 2. It is to avoid cycles between reductions.

§

RetVar(Arc<String>)

A value variable.

This requires the expression to be Ret variant. It is used in special rules such as (\k)(x) => \k.

§

RetIntVar(Arc<String>)

A value variable that is an integer.

§

RetPosVar(Arc<String>)

A value variable that is positive or zero.

§

RetStrictPosVar(Arc<String>)

A value that is strictly positive (non-zero).

§

RetNegVar(Arc<String>)

A value variable that is negative and non-zero.

Binds to its positive value.

§

NotRetVar(Arc<String>)

A variable that is not a value variable.

§

NotInVarName(Arc<String>, Arc<String>)

Binds to left variable name that does not occur in expression bound to the right variable.

§

BinopRetVar(Arc<String>, Arc<String>, Box<Symbol>)

Compute a binary function.

This is used when the right side of the rule computes something from two left side expressions.

§

TernopRetVar(Arc<String>, Arc<String>, Arc<String>, Box<Symbol>)

Compute a ternary function.

This is used when the right side of the rule computes something from three left side expressions.

§

UnopRetVar(Arc<String>, Box<Symbol>)

Compute a unary function.

This is used when the right side of the rule computes something from a left side expression.

§

NoConstrVar(Arc<String>)

A function without domain constraints.

§

NoSubstVar(Arc<String>)

A variable that is not substitution.

§

Dup

dup duplicate argument \(x) = (x, x).

§

False1

\false for one argument.

§

Not

not.

§

Idb

id for booleans.

§

True1

\true for one argument.

§

False2

\false for two arguments.

§

True2

\true for two arguments.

§

And

and.

§

Or

or.

§

Eqb

eq for booleans.

§

Xor

xor.

§

Nand

nand.

§

Nor

nor.

§

Exc

exc.

§

Imply

imply.

§

Fstb

fst for booleans.

§

Sndb

snd for booleans.

§

Even

even.

§

Odd

odd.

§

Abs

abs.

§

Lt

lt.

§

Rlt

(< _)(_).

§

Le

le.

§

Rle

(<= _)(_).

§

Gt

gt.

§

Rgt

(> _)(_).

§

Ge

ge.

§

Rge

(>= _)(_).

§

Neg

neg.

§

Inc

inc.

§

Reci

reci (reciprocal).

§

Conj

conj (complex conjugate).

§

Norm

norm (vector norm).

§

Sqnorm

sqnorm (vector square norm).

§

Add

add.

§

Sub

sub.

§

Rsub

(- _)(_)

§

Mul

mul.

§

Mulc

mulc (complex multiplication).

§

Div

div.

§

Rdiv

(/ _)(_)

§

Rem

rem.

§

Pow

pow.

§

Rpow

rpow.

§

Sqrt

sqrt.

§

Ln

ln.

§

Log2

log2.

§

Log10

log10.

§

Exp

exp.

§

Len

len.

§

Concat

concat.

§

Sum

sum.

§

Min2

min2.

§

Max2

max2.

§

Min

min.

§

Max

max.

§

ArgMax

arg_max.

§

ArgMin

arg_min.

§

SoftMax

soft_max.

§

SoftMin

soft_min.

§

SoftArgMax

soft_arg_max.

§

SoftArgMin

soft_arg_min.

§

Range

range [a, b].

§

Rangel

rangel [a, b).

§

Ranger

ranger (a, b].

§

Rangem

rangem (a, b).

§

Prob

prob [0, 1].

§

Probl

probl [0, 1).

§

Probr

probr (0, 1].

§

Probm

probm (0, 1).

§

MulMat

mul_mat.

§

Col

col (index, matrix).

Looks up column vector by index in a matrix.

§

Det

det.

§

Dim

dim.

§

Transpose

transpose.

§

IsSquareMat

is_square_mat,

§

Base

base (len, index).

Constructs a list with zeroes of specified length, but with 1 at the index.

§

Fst

fst.

§

Snd

snd.

§

Sin

sin.

§

Asin

asin.

§

Cos

cos.

§

Acos

acos.

§

Tan

tan.

§

Atan

atan.

§

Atan2

atan2.

§

Dot

dot.

§

Push

push.

§

PushFront

push_front.

§

Item

item (index, list).

§

El

el.

§

Re

re.

§

Im

im.

§

Id

Generic id.

§

Eq

Generic eq.

§

Neq

Generic neq.

§

Inv

Function inverse inv.

§

Deriv

Derivative.

§

Integ

Integral.

§

Pariv

Partial derivative.

§

If

if.

This is used in Boolean functions.

§

Ex

Existential path .

§

Triv

Trivial path .

§

AnyType

any, any type.

§

RetType

\, the type of \x.

§

VecType

The type of lists.

§

Rty

The judgement (: a)(b).

§

VecOp

vec_op.

Applies a binary function component-wise to lists.

§

VecUop

vec_uop.

Applies a unary function component-wise to lists.

§

Arity

arity.

§

Pi

pi or π.

§

Tau

tau or τ.

§

Eps

eps or ε.

§

Imag

imag (complex imaginary base).

§

Imag2

imag2 (second complex imaginary base for quaternions).

§

Imag3

imag3 (third complex imaginary base for quaternions).

§

TypeOf

type_of.

§

BoolType

bool.

§

F64Type

f64.

§

QuatType

quat (type of quaternions).

§

Inf

inf (infinity).

§

Both

both (indeterminate).

§

Neither

neither (uninhabited).

§

Subst

subst (substitution).

Implementations§

source§

impl Symbol

source

pub fn precedence(&self) -> Option<u8>

Returns the operator presedence of symbol.

source§

impl Symbol

source

pub fn display(&self, w: &mut Formatter<'_>, rule: bool) -> Result<(), Error>

Used to display format with additional options.

source§

impl Symbol

source

pub fn arity(&self) -> Option<usize>

Returns the arity of a symbol.

Trait Implementations§

source§

impl Clone for Symbol

source§

fn clone(&self) -> Symbol

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Symbol

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Symbol

source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<Arc<String>> for Symbol

source§

fn from(val: Arc<String>) -> Symbol

Converts to this type from the input type.
source§

impl Into<Expr> for Symbol

source§

fn into(self) -> Expr

Converts this type into the (usually inferred) input type.
source§

impl Into<Symbol> for &'static str

source§

fn into(self) -> Symbol

Converts this type into the (usually inferred) input type.
source§

impl PartialEq for Symbol

source§

fn eq(&self, other: &Symbol) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Symbol

source§

fn partial_cmp(&self, other: &Symbol) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl StructuralPartialEq for Symbol

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.