   (-seq [coll]
     (cond
       (zero? cnt) nil
-      (< cnt 32) (array-seq tail)
-      :else (chunked-seq coll 0 0)))
+      (<= cnt 32) (IndexedSeq. tail 0)
+      :else (chunked-seq coll (first-array-for-longvec coll) 0 0)))
 
   ICounted
   (-count [coll] cnt)

  (-chunked-first [coll]
    (array-chunk node off))
  (-chunked-rest [coll]
    (let [l (alength node)
          s (when (< (+ i l) (-count vec))
              (chunked-seq vec (+ i l) 0))]
      (if (nil? s)
        ()
        s)))

  IChunkedNext
  (-chunked-next [coll]
    (let [l (alength node)
          s (when (< (+ i l) (-count vec))
              (chunked-seq vec (+ i l) 0))]
      (if (nil? s)
        nil
        s)))
  IHash
  (-hash [coll] (caching-hash coll hash-coll __hash))


      :else (do (pv-aset node subidx nil)
                node))))

(defn- unchecked-editable-array-for [tv i]
  ;; invariant: i is a valid index of tv.
  (if (>= i (tail-off tv))
    (.-tail tv)
    (let [root (.-root tv)]
      (loop [node  root
             level (.-shift tv)]
        (if (pos? level)
          (recur (tv-ensure-editable
                   (.-edit root)
                   (pv-aget node
                            (bit-and (bit-shift-right-zero-fill i level)
                                     0x01f)))
                 (- level 5))
          (.-arr node))))))

(deftype TransientVector [^:mutable cnt
                          ^:mutable shift
