Description Usage Arguments Value
MapExpressionNodes
transforms an expression expr
by
replacing every node in the tree with the result of applying a function
f
. The parameters functions
, inners
, and leafs
control if f
should be applied to the function symbols, inner
subtrees, and leafs of expr
, respectively.
MapExpressionLeafs
and MapExpressionSubtrees
are shorthands
for calls to MapExpressionNodes
.
expr
.
an expression expr
.
expr
, given as list of nodes and and list of vertices. Each
vertex is represented as a pair of indices into the list of nodes.
AllExpressionNodes
checks if all nodes in the tree of expr
satisfy the predicate p
(p
returns TRUE
for every node).
This function short-cuts returning FALSE
as soon as a node that
does not satisfy p
is encountered.
AnyExpressionNode
checks if any node in the tree of expr
satisfies the predicate p
. This function short-cuts returning
TRUE
as soon as a node that satisfies p
is encountered.
subtreeAt
returns the subtree at index
.
replaceSubtreeAt
replaces the subtree at index
with
replacement
and returns the result.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | MapExpressionNodes(f, expr, functions = TRUE, inners = FALSE,
leafs = TRUE)
MapExpressionLeafs(f, expr)
MapExpressionSubtrees(f, expr)
FlattenExpression(expr)
subtrees(expr, functions = FALSE, inners = TRUE, leafs = TRUE)
expressionGraph(expr)
AllExpressionNodes(p, expr)
AnyExpressionNode(p, expr)
subtreeAt(expr, index)
replaceSubtreeAt(expr, index, replacement)
|
f |
The function to apply. |
functions |
Whether to apply |
inners |
Whether to apply |
leafs |
Wheter to apply |
p |
The predicate to check. |
expr |
The expression to transform. |
index |
An in-order subtree index starting from |
replacement |
An expression. |
The transformed expression.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.