                               gb (gensym "b__")
                               do-cmod (fn do-cmod [[[k v :as pair] & etc]]
                                         (core/cond
-                                          (= k :let) `(let ~v ~(do-cmod etc))
-                                          (= k :while) `(when ~v ~(do-cmod etc))
-                                          (= k :when) `(if ~v
-                                                         ~(do-cmod etc)
-                                                         (recur
-                                                           (unchecked-inc ~gi)))
-                                          (core/keyword? k)
-                                            (err "Invalid 'for' keyword " k)
-                                          :else
-                                            `(do (chunk-append ~gb ~body-expr)
-                                                 (recur (unchecked-inc ~gi)))))]
+                                         (= k :let) `(let ~v ~(do-cmod etc))
+                                         (= k :while) `(when ~v ~(do-cmod etc))
+                                         (= k :when) `(if ~v
+                                                        ~(do-cmod etc)
+                                                        (recur
+                                                         (unchecked-inc ~gi)))
+                                         (core/keyword? k)
+                                         (err "Invalid 'for' keyword " k)
+                                         :else
+                                         `(do (chunk-append ~gb ~body-expr)
+                                              (recur (unchecked-inc ~gi)))))]
                           `(fn ~giter [~gxs]
                              (lazy-seq
-                               (loop [~gxs ~gxs]
-                                 (when-let [~gxs (seq ~gxs)]
-                                   (if (chunked-seq? ~gxs)
-                                     (let [c# ^not-native (chunk-first ~gxs)
-                                           size# (count c#)
-                                           ~gb (chunk-buffer size#)]
-                                       (if (coercive-boolean
-                                            (loop [~gi 0]
-                                              (if (< ~gi size#)
-                                                (let [~bind (-nth c# ~gi)]
-                                                  ~(do-cmod mod-pairs))
-                                                true)))
-                                         (chunk-cons
-                                           (chunk ~gb)
-                                           (~giter (chunk-rest ~gxs)))
-                                         (chunk-cons (chunk ~gb) nil)))
-                                     (let [~bind (first ~gxs)]
-                                       ~(do-mod mod-pairs)))))))))))]
+                              (loop [~gxs ~gxs]
+                                (when-let [~gxs (seq ~gxs)]
+                                  (if (chunked-seq? ~gxs)
+                                    (let [c# ^not-native (chunk-first ~gxs)
+                                          size# (count c#)
+                                          ~gb (chunk-buffer size#)]
+                                      (if (coercive-boolean
+                                           (loop [~gi 0]
+                                             (if (< ~gi size#)
+                                               (let [~bind (-nth c# ~gi)]
+                                                 ~(do-cmod mod-pairs))
+                                               true)))
+                                        (chunk-cons
+                                         (chunk ~gb)
+                                         (~giter (chunk-rest ~gxs)))
+                                        (chunk-cons (chunk ~gb) nil)))
+                                    (let [~bind (first ~gxs)]
+                                      ~(do-mod mod-pairs)))))))))))]
     `(let [iter# ~(emit-bind (to-groups seq-exprs))]
        (iter# ~(second seq-exprs)))))
 

  (when (seq (apply disj (apply core/hash-set (keys options)) valid-keys))
    (throw
     (apply core/str "Only these options are valid: "
	    (first valid-keys)
	    (map #(core/str ", " %) (rest valid-keys))))))

(defmacro defmulti
  "Creates a new multimethod with the associated dispatch function.

                    (interpose ",")
                    (apply core/str))]
    (vary-meta
     (list* 'js* (core/str "[" xs-str "]") rest)
     assoc :tag 'array)))

(defmacro make-array
  [size]
  (vary-meta
   (if (core/number? size)
     `(array ~@(take size (repeat nil)))
     `(js/Array. ~size))
   assoc :tag 'array))

(defmacro list
  ([] `cljs.core.List.EMPTY)
  ([x & xs]
     `(-conj (list ~@xs) ~x)))

(defmacro vector
  ([] `cljs.core.PersistentVector.EMPTY)
  ([& xs]
     (let [cnt (count xs)]
       (if (core/< cnt 32)
         `(cljs.core.PersistentVector. nil ~cnt 5
                                       cljs.core.PersistentVector.EMPTY_NODE (array ~@xs) nil)
         (vary-meta
          `(cljs.core.PersistentVector.fromArray (array ~@xs) true)
          assoc :tag 'cljs.core/PersistentVector)))))

(defmacro array-map
  ([] `cljs.core.PersistentArrayMap.EMPTY)
  ([& kvs]
     (core/cond
      (core/> (count kvs) 16)
      `(hash-map ~@kvs)

      (let [keys (map first (partition 2 kvs))]
        (core/and (every? #(= (:op %) :const)
                          (map #(clojure.tools.analyzer.js/analyze % &env) keys))
                  (= (count (into #{} keys)) (count keys))))
      `(cljs.core.PersistentArrayMap. nil ~(clojure.core// (count kvs) 2) (array ~@kvs) nil)

