                              (let [v (vec (.toArray a))]
                                ;;clear first!
                                (.clear a)
-                               (rf result v)))]
+                               (unreduced (rf result v))))]
                 (rf result)))
            ([result input]
               (let [pval @pa

                           (let [v (vec (.toArray a))]
                             ;;clear first!
                             (.clear a)
                             (rf result v)))]
              (rf result)))
         ([result input]
            (.add a input)

  "Returns true if x is the result of a call to reduced"
  [r]
  (instance? Reduced r))

(defn ensure-reduced
  "If x is already reduced?, returns it, else returns (reduced x)"
  [x]
  (if (reduced? x) x (reduced x)))

(defn unreduced
  "If x is reduced?, returns (deref x), else returns x"
  [x]
  (if (reduced? x) (deref x) x))

;; generic to all refs
;; (but currently hard-coded to atom!)
