 ; should use: count, nth
 (defn- vector-seq [vector i]
   (lazy-seq
-    (when (< i (icount vector))
-      (cons (inth vector i) (vector-seq vector (inc i))))))
+    (when (< i (-count vector))
+      (cons (-nth vector i) (vector-seq vector (inc i))))))
 
 (deftype Vector [meta array]
   IWithMeta
-  (iwith-meta [coll meta] (Vector. meta array))
+  (-with-meta [coll meta] (Vector. meta array))
 
   IMeta
-  (imeta [coll] meta)
+  (-meta [coll] meta)
 
   IStack
-  (ipeek [coll]
+  (-peek [coll]
     (let [count (.length array)]
       (when (> count 0)
         (aget array (dec count)))))
-  (ipop [coll]
+  (-pop [coll]
     (if (> (.length array) 0)
       (let [new-array (array-clone array)]
         (. new-array (pop))


(extend-type goog.global.Array
  ISeqable
  (iseq [array] (array-seq array 0)))

(deftype List [meta first rest count]
  IWithMeta
  (iwith-meta [coll meta] (new List meta first rest count))

  IMeta
  (imeta [coll] meta)

  ISeq
  (ifirst [coll] first)
  (irest [coll] (if (nil? rest) (new EmptyList meta) rest))

  IStack
  (ipeek [coll] first)
  (ipop [coll] (irest coll))

  ICollection
  (iconj [coll o] (new List meta o coll (inc count)))

; IEmptyableCollection
; (iempty [coll] coll)

  ISeqable
  (iseq [coll] coll)

  ICounted
  (icount [coll] count))

(deftype EmptyList [meta]
  IWithMeta
  (iwith-meta [coll meta] (new EmptyList meta))

  IMeta
  (imeta [coll] meta)

  ISeq
  (ifirst [coll] nil)
  (irest [coll] nil)

  IStack
  (ipeek [coll] nil)
  (ipop [coll] #_(throw "Can't pop empty list"))

  ICollection
  (iconj [coll o] (new List meta o nil 1))

; IEmptyableCollection
; (iempty [coll] coll)

  ISeqable
  (iseq [coll] nil)

  ICounted
  (icount [coll] 0))

(set! cljs.core.List.EMPTY (new EmptyList nil))


      #_(throw "Can't pop empty vector")))

  ICollection
  (-conj [coll o]
    (let [new-array (array-clone array)]
      (.push new-array o)
      (Vector. meta new-array)))
