         (recur (z/up zip) child)
         build))))
 
-(defn node
-  [[triple & xs] element]
-  (if (= (count xs) 0)
-    (Node. triple element 0 [])
-    (Node. triple nil 1 [(node xs element)])))
+(defn fetch [node index]
+  "takes a node and an index and returns a recreation of the node at that index
+  as a limb"
+  (-> node
+      (crawl-to index)
+      (crawl-out)))
+

  this)

(defn left-to-right
  [position tree]
  (loop [pos position, branch (-> tree node-zip z/down), acc 0]
    (let [{:keys [sub-counter element]} (z/node branch)
          acc* (if element (inc acc) acc)]
      (if (= pos 0)

               (z/right branch)
               (+ sub-counter acc*))))))

(defn index-of
  "returns the zero-based index of a limb in a node"
  [node limb]
  (if-let [paths (indexes node limb)]
      (loop [paths paths,
             node node,
             acc (if (:element node) 1 0)]
        (let [head (first paths), tail (next paths)
              {:keys [children]} node]
          (if head
            (recur tail
                   (nth children head)
                   (+ acc (left-to-right head node)))
            (dec acc)))) ;zero-based index
      nil))

(defn indexes
  "returns a vector of numbers for each level that the index of a limb is
  located at in a node"
  [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)))
        nil
        ;does the limb have more children
        (if (or (= (count (:children limb)) 0)
                (= (count children) 0))
          (conj path index)
          (recur (conj path index)
                 (get-in node [:children index])
                 (get-in limb [:children 0])))))))

(defn crawl-to
  "returns a zipper with it's location where the index in a node"
  [node index]
  (loop [zip (node-zip node)
         to-go index]
