   (^array [^array arr ^number cut-from ^number cut-to]
     (.slice arr cut-from cut-to)))
 
-(defn splice ^array [^array  arr
+(defn ^array splice [^array  arr
                      ^number splice-from
                      ^number splice-to
                      ^array  xs]
   (cut-n-splice arr 0 (alength arr) splice-from splice-to xs))
 
-(defn insert ^array [^array arr
+(defn ^array insert [^array arr
                      ^number idx
                      ^array xs]
   (cut-n-splice arr 0 (alength arr) idx idx xs))
 
 ;; 
 
-(defn replace-keys ^array [^array old-keys ^number idx ^array new-keys]
+(defn ^array replace-keys [^array old-keys ^number idx ^array new-keys]
   (let [new-keys-l (alength new-keys)]    
     (if (and (== 1 new-keys-l)
              (eq (aget new-keys 0) (nth old-keys idx)))

        (pos? cmp) (recur arr l (dec m) k)
        :else m))
    l))

(defn lookup ^number [^array arr key]
  (binary-search arr 0 (dec (alength arr)) key))

(defn -seek ^number [set key]
  (loop [node (.-root set)
         path  0
         path-offset 0
         depth 1]
    (let [keys (.-keys node)
          idx  (lookup keys key)]
      (if (== depth (.-depth set))
        (bit-or (bit-shift-left idx path-offset) path)
        (let [idx (if (== idx (alength keys)) (dec idx) idx)]
          (recur (aget (.-pointers node) idx)
                 (bit-or (bit-shift-left idx path-offset) path)
                 (+ path-offset path-bit-offset)
                 (inc depth)))))))

(defn seek [set key]
  (binding [*cmp* (.-comparator set)]
    (-seek set key)))

;; Array operations

(defn cut-n-splice ^array [^array  arr
                           ^number cut-from
                           ^number cut-to
                           ^number splice-from

          s  (into (btset) xss)]
      (when-not (= (vec s) xs)
        (println xss))))
  (println "Checked")
  :ok)

;; (test-rand)

;; perf

(def test-matrix [:target  { ;; "sorted-set" (sorted-set)
                             "btset"      (btset)}
;;                   :size    [100 500 1000 2000 5000 10000 20000 50000]
                  :size    [100 500 20000]
                  :method  { "conj"    (fn [opts] (into (:target opts) (:range opts)))
                             "lookup"  (fn [opts] (contains? (:set opts) (rand-int (:size opts))))
                             "iterate" (fn [opts] (doseq [x (:set opts)] (+ 1 x)))
                            }])

(defn test-setup [opts]
  (let [range (shuffle (range (:size opts)))]
