 (defn prev-path
   "Returns path representing previous item before `path` in natural traversal order,
    or -1 if `path` was already beginning of a tree"
-  [^BTSet set path]
+  ^long [^BTSet set ^long path]
   (-prev-path (.-root set) path (.-shift set)))
 
 

            (* res avg-len))))
      (- idx-r idx-l))))

(defn distance [^BTSet set path-l path-r]
  (cond
    (== path-l path-r) 0
    (== (inc path-l) path-r) 1


;; distance

(defn -distance [node ^long left ^long right ^long level]
  (let [idx-l (path-get left level)
        idx-r (path-get right level)]
    (if (pos? level)
