 (defn- replace-range [v replacement idxs]
   (concat (subvec v 0 (first idxs))
           replacement
-          (subvec v (inc (last idxs)) (count v))))
+          (subvec v (inc (peek idxs)) (count v))))
 
 (defn- index-conversions [^Types src idxs [[_ ^Types replacement] ^Conversion conv]]
   [src

    (->> (continuous-combinations (.arity src))
         (mapcat
           (fn [idxs]
             (let [^Types input (types (subvec (.types src) (first idxs) (inc (last idxs))))]
               (->> (possible-conversions g input)
                    (filter (fn [[[_ ^Types replacement] _]]
                              (>= max-arity (+ (.arity replacement)

   (fn [vs]
     (let [vs (vec vs)]
       (replace-range vs
                      ((.f conv) (subvec vs (first idxs) (inc (peek idxs))))
                      idxs)))
   (.cost conv)])

