diff --git a/fcore/persistent-vector.sml b/fcore/persistent-vector.sml index 74f7840..11aca07 100644 --- a/fcore/persistent-vector.sml +++ b/fcore/persistent-vector.sml @@ -529,6 +529,13 @@ struct LEAF (items, sizes) end + fun countDepthLoop (counter, tree) = + case tree of + BRANCH (nodes, _) => countDepthLoop (counter + 1, Vector.sub (nodes, 0)) + | LEAF (_, _) => counter + 1 + + fun countDepth tree = countDepthLoop (0, tree) + (* functions only for testing *) fun fromListLoop (lst, acc) = case lst of