TypedMst

interface TypedMst<T>(source)

MST form where all values belong to the type T. It is optimal for constant folding, dynamic compilation, etc.

Parameters

T

the type.

Inheritors

Types

Link copied to clipboard
class Binary<T>(val operation: String, val function: Function<T>, val left: TypedMst<T>, val right: TypedMst<T>) : TypedMst<T>

A node containing binary operation.

Link copied to clipboard
class Constant<T>(val value: T, val number: Number?) : TypedMst<T>

The non-numeric constant value.

Link copied to clipboard
class Unary<T>(val operation: String, val function: (T) -> T, val value: TypedMst<T>) : TypedMst<T>

A node containing a unary operation.

Link copied to clipboard
class Variable<T>(val symbol: Symbol) : TypedMst<T>

The node containing a variable

Functions

Link copied to clipboard
fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, vararg arguments: Pair<Symbol, T>): T

Interprets the TypedMst node with this Algebra and optional arguments.

fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, arguments: Map<Symbol, T>): T

Interprets the TypedMst node with this Algebra and arguments.

Link copied to clipboard
fun <T : Any> TypedMst<T>.toExpression(algebra: Algebra<T>): Expression<T>

Interpret this TypedMst node as expression.