         (recur (dec pos)
                (z/right branch)
                (+ sub-counter acc*))))))
-
-(defn index-of
-  "returns the zero-based index of a limb in a node"
-  [node limb]
-  (let [paths (indexes node limb)]
-    (if (last paths)
-      (loop [[head & tail] paths,
-             {:keys [children] :as node} node,
-             acc (if (:element node) 1 0)]
-        (if head
-          (recur tail
-                 (nth children head)
-                 (+ acc (left-to-right head node)))
-          (dec acc)))
-      nil))) ;zero-based index
-
-(defn indexes
-  "returns a vector of numbers for each level that the index of a limb is
-  located at in a node. returns nil instead of a number when it can't find the
-  limb (eg [1 2 3 nil])"
-  [node limb]
-  (loop [path [], node node, limb limb]
-    (let [{:keys [children]} node
-          index (find-in (map :triple children) (:triple limb))]
-      ;does the node contain the limb
-      (if (or (< index 0)
-              (and (= index 0) (= (count children) 0)))
-        (conj path nil)
-        ;does the limb have more children
-        (if (or (= (count (:children limb)) 0)
-                (= (count children) 0))
-          (conj path index)
-          (recur (conj path index)
-                 (nth children index)
-                 (first (:children limb))))))))
 
 (defn crawl-to
   "returns a zipper with it's location where the index in a node"

            element
            sub-counter
            (sorted :triple children))))

(defn node-zip
  [root]
  (z/zipper :children (comp seq :children) make-node root))

(defn node
  [[triple & xs] element]
  (if (= (count xs) 0)
    (Node. triple element 0 [])
    (Node. triple nil 1 [(node xs element)])))

(declare add del fetch index-of indexes)

(defn nth-child
  "Returns the loc of the nth child of the node at this loc, or

        (recur (z/up zip) child)
        build))))


