      (let [arglist (list* x args)
            fixed-arity (.-cljs$lang$maxFixedArity f)]
        (if (.-cljs$lang$applyTo f)
-         (if (<= (bounded-count arglist fixed-arity)
-                 fixed-arity)
+         (if (<= (bounded-count arglist (inc fixed-arity)) fixed-arity)
            (.apply f f (to-array arglist))
            (.cljs$lang$applyTo f arglist))
          (.apply f f (to-array arglist)))))

    (if (and xs (pos? n))
      (recur (dec n) (next xs))
      xs)))

(extend-type default
  IIndexed
  (-nth
   ([coll n]
      (if-let [xs (nthnext coll n)]
        (first xs)
        (throw (js/Error. "Index out of bounds"))))
   ([coll n not-found]
      (if-let [xs (nthnext coll n)]
        (first xs)
        not-found))))


;;;;;;;;;;;;;;;;;;;;;;;;;; basics ;;;;;;;;;;;;;;;;;;


     (let [arglist (cons a (cons b (cons c (cons d (spread args)))))
           fixed-arity (.-cljs$lang$maxFixedArity f)]
       (if (.-cljs$lang$applyTo f)
         (if (<= (bounded-count arglist (inc fixed-arity)) fixed-arity)
           (.apply f f (to-array arglist))
           (.cljs$lang$applyTo f arglist))
         (.apply f f (to-array arglist))))))
