A hash of a tree's structure – node kinds, child structure, leaf positions,
names, and the class and aux data of each object of a class registered with
register_tree_node() – consistent with tree_equal(): trees that are
tree_equal() hash to the same value. Intended as a cache key for
tree-structured dispatch within a session: a class folds in by the address
of its registration, so the hash of a tree with registered objects differs
between sessions.
Arguments
- tree
(
RTree)
A tree as returned bybuild_tree().
Examples
tree_hash(build_tree(list(a = 1))) == tree_hash(build_tree(list(a = 2)))
#> [1] TRUE
tree_hash(build_tree(list(a = 1))) == tree_hash(build_tree(list(b = 1)))
#> [1] FALSE