Shared helpers that operate on the immutable Expression tree. All transformations are functional: they return a new node and never mutate the input tree.
ExpressionExtensions
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| Clone | 1 | Make a deep copy of the given expression node. |
| ExprEquals | 1 | Compare two expression trees structurally (ignoring parentheses which are not represented in the tree). |
| GetSymbols | 1 | All distinct variable symbol names that appear in the expression. |
| IsConstant | 1 | Test if the expression contains no variable symbols (i.e. |
| DependsOn | 1 | Test if the expression still references the given variable symbol. |
| FlattenSum | 1 | Flatten nested additions into a list of summands. |
| FlattenProduct | 1 | Flatten nested multiplications into a list of factors. |
| SplitCoefficient | 1 | Split a term into a numeric coefficient and the remaining body, such that term = coeff * body. |
| NumericValue | 1 | If the expression is a literal number, returns its value; otherwise returns Nothing. |
03 Members
Expression)Make a deep copy of the given expression node.
Expression, Expression)Compare two expression trees structurally (ignoring parentheses which are not represented in the tree).
Expression)All distinct variable symbol names that appear in the expression.
Expression)Test if the expression contains no variable symbols (i.e. it is a pure constant that can be evaluated numerically).
Expression, String)Test if the expression still references the given variable symbol.
Expression)Flatten nested additions into a list of summands. A subtraction a - b is represented as a + (-b).
Expression)Flatten nested multiplications into a list of factors. A division a / b is represented as a * (1/b).
Expression, Double, Expression)Split a term into a numeric coefficient and the remaining body, such that term = coeff * body. Only a leading numeric factor is recognised: 2*x^2 yields coeff=2, body=x^2; x*2 yields coeff=2, body=x.
Expression)If the expression is a literal number, returns its value; otherwise returns Nothing.