A hash of a tree's structure – node kinds, child structure, leaf positions,
and names – consistent with tree_equal(): trees that are tree_equal()
hash to the same value. Intended as a cache key for tree-structured
dispatch.
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