 
 (defn- can-edit [x y]
   (and (coercive-not= x nil) (coercive-not= y nil) (identical? x y)))
+
+(defn- inode-kv-reduce [arr kvs nodes f init]
+  (let [kv-len (* 2 kvs)
+        node-len (+ kv-len nodes)]
+    (loop [i 0 init init]
+      (cond (< i kv-len)
+            (let [init (f init (aget arr i) (aget arr (inc i)))]
+              (if (reduced? init)
+                @init
+                (recur (+ i 2) init)))
+            (< i node-len)
+            (let [init (.kv-reduce (aget arr i) f init)]
+              (if (reduced? init)
+                @init
+                (recur (inc i) init)))
+            :else init))))
 
 (deftype BitmapIndexedNode [edit ^:mutable datamap ^:mutable nodemap ^:mutable arr]
   Object

            ["dissoc"
             (count dhm1)
             (= (into #{} (vals dhm1)) (into #{} (range dtimes)))
             (= (into #{} (vals dhm1)) (into #{} (map #(get dhm1 (str "key" %)) (range dtimes))))
             (= (keys dhm1) (map (fn [[k v]] k) dhm1))
             (= (into #{} (keys dhm1)) (into #{} (map #(str "key" %) (range dtimes))))]))
  (do
    (js/console.profile "CLJS Map")

      (let [new-root (.inode-without root nil 0 (hash k) k (Box. false false))]
        (if (identical? new-root root)
          coll
          (PersistentHashMap. meta (dec cnt) new-root nil)))))

  IKVReduce
  (-kv-reduce [coll f init]
    (cond
      (reduced? init)          @init
      (not (nil? root)) (.kv-reduce root f init)
      :else                    init)))

(set! (.-EMPTY PersistentHashMap) (PersistentHashMap. nil 0 nil empty-unordered-hash))

