 (ns cljs.fast-map.core
   (:refer-clojure :exclude [Box ->Box BitmapIndexedNode ->BitmapIndexedNode
                             HashCollisionNode ->HashCollisionNode
+                            PersistentHashMap ->PersistentHashMap
+                            TransientHashMap ->TransientHashMap
+                            NodeSeq ->NodeSeq
                             create-inode-seq create-array-node-seq create-node
                             mask bitmap-indexed-node-index bitpos]))
+
+(declare NodeSeq TransientHashMap PersistentHashMap)
 
 (deftype Box [^:mutable added ^:mutable modified])
 

            (.inode-assoc edit shift key1hash key1 val1 changed?)
            (.inode-assoc edit shift key2hash key2 val2 changed?))))))

(comment
    (let [em (.-EMPTY BitmapIndexedNode)
          sent (js-obj)]
      (let [bn1 (.inode-assoc em nil 0 (hash :foo1) :foo1 :bar  (Box. false false))
            bn2 (.inode-assoc bn1 nil 0 (hash :foo1) :foo1 :not-bar  (Box. false false))
            bn3 (.inode-assoc bn1 nil 0 (hash :foo2) :foo2 :bar2  (Box. false false))
            nn1 (.inode-assoc bn3 nil 0 (hash :foo2) :foo3 :split-bar  (Box. false false))]
        (println "Pesistent Assoc")
        (println [(.-arr em) (.-arr bn1) (.-arr bn2) (.-arr bn3) (.-arr nn1)
                  (.-arr (aget (.-arr nn1) 2))]))
      (let [bn1 (.inode-assoc em nil 0 (hash :foo1) :foo1 :bar  (Box. false false))
            tbn1 (.inode-assoc bn1 sent 0 (hash :foo1) :foo1 :my-bar  (Box. false false))
            tbn2 (.inode-assoc tbn1 sent 0 (hash :foo1) :foo1 :another-bar  (Box. false false))
            tbn3 (.inode-assoc tbn2 sent 0 (hash :foo1) :foo1 :changed  (Box. false false))]
        (println "Transient Assoc")
        (println [(.-arr em) (.-arr bn1) (.-arr tbn1) (.-arr tbn2) (.-arr tbn3)])) ))
      (aset dst idx-new node)
      (array-copy arr (+ idx-new 2) dst (inc idx-new) (- (alength arr) idx-new 2))
      (BitmapIndexedNode. e (bit-or datamap bit) (bit-xor nodemap bit) dst)))

  (inode-seq [inode]
    (NodeSeq. nil arr (* 2 (bit-count datamap)) (bit-count nodemap) 0 nil nil))

  (inode-assoc [inode aedit shift hash key val changed?]
    (let [bit (bitpos hash shift)]
