         ;(println "path is" path)
         (let [insert-index (first path)
               insert-node (fnext path)
+              ;;TODO this apply should be direct dispatch b/c this is slow
               insert-result (apply insert insert-node insert-index new-elts)]
           ;(println "insert result was" insert-result)
           (if (= 2 (count path)) ; we've only got the root node


(def b 3)

(defprotocol INodeLookup
  (lookup [node key] "Returns the child node which contains the given key"))

(defprotocol IKeyCompare
  (compare [key1 key2]))

(defprotocol IInsert
  (insert [node index new-child]
          [node index new-child1 median new-child2]
          "Returns one or 2 new nodes, if it had to split"
          ))

(extend-protocol IKeyCompare
  Object
  (compare [key1 key2] (clojure.core/compare key1 key2)))

(defprotocol IResolve
  "This is how we store the children. The indirection enables background
   fetch and decode of the resource."
  (resolve [this]))

(defn scan-children-array
  "This function takes an array of keys. There must be an odd # of elts in it.

    (let [new-children (assoc children index new-child)]
      [(->RootNode keys new-children)]))
  (insert [node index new-child1 median new-child2]
    (handle-multi-insert ->RootNode node index new-child1 median new-child2))
  INodeLookup
  (lookup [root key]
    (scan-children-array keys key)))
