                     result)
                   (let [v (vec (.toArray a))]
                     (.clear a)
-                    (let [ret (f1 result v)]
+                    (let [ret (rf result v)]
                       (when-not (reduced? ret)
                         (.add a input))
                       ret)))))))))

  "Returns a lazy sequence removing consecutive duplicates in coll.
  Returns a transducer when no collection is provided."
  ([]
   (fn [f1]
     (let [pa (atom ::none)]
       (fn
         ([] (f1))
         ([result] (f1 result))
         ([result input]
            (let [prior @pa]
              (reset! pa input)
              (if (= prior input)
                result
                (f1 result input))))))))
  ([coll] (sequence (dedupe) coll)))

(defn random-sample

  side-effects.  Returns a stateful transducer when no collection is
  provided."
  ([f]
   (fn [rf]
     (let [ia (atom -1)]
       (fn
         ([] (rf))
         ([result] (rf result))
         ([result input]
            (let [i (swap! ia inc)
                  v (f i input)]
              (if (nil? v)
                result
                (rf result v))))))))
  ([f coll]
     (letfn [(keepi [idx coll]
               (lazy-seq
