gives the expression corresponding to the tree tree.
interprets the data of the descendants according to struct.
- In TreeExpression[tree], tree must be a Tree object.
- Possible forms for struct include:
"HeadTrees" trees corresponding to heads of subexpressions of the expression "Heads" heads of subexpressions of the expression "Arguments" arguments of subexpressions of the expression by level "Subexpressions" subexpressions of the expression by level "Atoms" atomic subexpressions of the expression at level -1
- Possible structures for the expression f[a,b][g[1,2],x,y] include:
- TreeExpression[ExpressionTree[expr,struct],struct] gives expr.
Examplesopen allclose all
Basic Examples (1)
Properties & Relations (7)
The expression constructed by TreeExpression is evaluated before being returned:
Use TreeFold to insert a parent node above each subtree:
Map maps on the arguments in an expression by default:
Use TreeFold to insert a sibling node before each subtree:
TreeMap maps on the data of subtrees in a tree:
Map can map on the heads and leaves directly:
TreeMap can map on the data of just the leaves in a tree:
Map can map on the atoms in an expression directly:
Wolfram Research (2021), TreeExpression, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeExpression.html.
Wolfram Language. 2021. "TreeExpression." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TreeExpression.html.
Wolfram Language. (2021). TreeExpression. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeExpression.html