term_hash/4

"term_hash(+ Term, + Depth, + Range, ? Hash" )

Unify Hash with a positive integer calculated from the structure of the term. The range of the positive integer is from 0 to, but not including, Range. If Depth is -1 the whole term is considered. Otherwise, the term is considered only up to depth 1, where the constants and the principal functor have depth 1, and an argument of a term with depth I has depth I+1.