RulesTree

RulesTree[data{rule1,rule2,}]

gives a tree whose root contains data and that has children specified by the rulei.

Details

  • RulesTree gives a Tree object.
  • The children of RulesTree[data{rule1,rule2,}] are given by {RulesTree[rule1],RulesTree[rule2],}.
  • RulesTree[data] for data not of the form {} is equivalent to RulesTree[data{}]. »

Examples

open allclose all

Basic Examples  (2)

Construct a tree with three leaves:

Construct a tree with several levels:

Scope  (2)

Construct a tree with one node:

Specify a list of children:

Properties & Relations  (2)

RulesTree constructs a tree associated with the given rules:

Use TreeRules on the result to recover the original rules:

RulesTree can be computed with NestTree:

Possible Issues  (1)

RulesTree[expr{}] is generally equivalent to RulesTree[expr]:

However, the empty list is necessary to specify a tree with data of the form lhs{e1,e2,}:

Without the empty list, this would be treated as a tree whose root contains lhs with children {RulesTree[e1],RulesTree[e2],}:

Wolfram Research (2021), RulesTree, Wolfram Language function, https://reference.wolfram.com/language/ref/RulesTree.html.

Text

Wolfram Research (2021), RulesTree, Wolfram Language function, https://reference.wolfram.com/language/ref/RulesTree.html.

BibTeX

@misc{reference.wolfram_2021_rulestree, author="Wolfram Research", title="{RulesTree}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/RulesTree.html}", note=[Accessed: 27-November-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_rulestree, organization={Wolfram Research}, title={RulesTree}, year={2021}, url={https://reference.wolfram.com/language/ref/RulesTree.html}, note=[Accessed: 27-November-2021 ]}

CMS

Wolfram Language. 2021. "RulesTree." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RulesTree.html.

APA

Wolfram Language. (2021). RulesTree. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RulesTree.html