trees :: TreeNode :: depth
self
root
# Depth in tree (length of the path from `self` to `root`) fun depth: Int do var node = parent var i = 0 while node != null do node = node.parent i += 1 end return i end