 
 (def test-matrix [:target    { ;; "sorted-set" (sorted-set)
                                "btset"      (btset)}
-                  :distinct? [true false]
+                  ;; :distinct? [true false]
 ;;                   :size    [100 500 1000 2000 5000 10000 20000 50000]
                   :size      [100 500 20000]
                   :method    { "conj"    (fn [opts] (into (:target opts) (:range opts)))

;; (def s0 (apply btset (range 20000)))
;; (def s1 (into (btset) (range 3)))
;; (apply btset (range 150))


(defn dump [node writer offset]
  (if (instance? LeafNode node)

            #js [(Node. (cut new-keys     0 middle)
                        (cut new-pointers 0 middle))
                 (Node. (cut new-keys     middle)
                        (cut new-pointers middle))]))))))

  (disj [this ^number key root? left right]
    (let [idx (.lookup this key)]
      (when-not (== -1 idx) ;; short-circuit, key not here
        (let [child       (aget pointers idx)
              left-child  (when (>= (dec idx) 0)                 (aget pointers (dec idx)))
              right-child (when (< (inc idx) (alength pointers)) (aget pointers (inc idx)))
              disjned     (.disj child key false left-child right-child)]
          (when disjned     ;; short-circuit, key not here
            (let [left-idx     (if left-child  (dec idx) idx)
                  right-idx    (if right-child (+ 2 idx) (+ 1 idx))
                  new-keys     (check-n-splice keys left-idx right-idx (.map disjned lim-key))
                  new-pointers (splice pointers left-idx right-idx disjned)]
              (rotate (Node. new-keys new-pointers) root? left right))))))))

(deftype LeafNode [keys]
  Object
  (toString [_] (pr-str* (vec keys)))
  
  (len [_]
    (alength keys))
  
  (merge [_ next]
    (LeafNode. (.concat keys (.-keys next))))
  
  (merge-n-split [_ next]
    (let [ks (merge-n-split keys (.-keys next))]
      (return-array (LeafNode. (aget ks 0))
                    (LeafNode. (aget ks 1)))))
  
  (lookup [_ key]
    (let [idx (binary-search keys 0 (dec (alength keys)) key)]
      (if (and (< idx (alength keys))
                 (eq (aget keys idx) key))
        idx
        -1)))

  (append [this ^number path _ key] ;; TODO figure out idx here
    (let [idx    (path-get path 0)
          keys-l (alength keys)]
      (cond
