             augmented-substitutions (augment-substitutions substitutions target)
             flattened-target (flatten-fake target augmented-substitutions)
             generated-fakes (generate-fakes
-                             (map-difference augmented-substitutions substitutions)
-                             overrides)]
-        [ (conj finished flattened-target)
-          (concat generated-fakes (rest pending))
-          augmented-substitutions])
-    [(conj finished target), (rest pending), substitutions])))
-  
-(defn unfold-expect-form__then__stay_put [loc]
-  (loop [ [finished pending substitutions] [ [] (zip/node loc) {} ]]
+          (map-difference augmented-substitutions substitutions)
+          overrides)]
+        [(conj finished flattened-target)
+         (concat generated-fakes (rest pending))
+         augmented-substitutions])
+      [(conj finished target), (rest pending), substitutions])))
+
+(defn- unfold-expect-form__then__stay_put [loc]
+  (loop [[finished pending substitutions] [[] (zip/node loc) {}]]
     (if (empty? pending)
       (zip/replace loc (apply list finished))
       (recur (unfolding-step finished pending substitutions)))))

(defn merge-metaconstant-bindings [bindings]
  (apply merge-with (fn [v1 v2]
                      (Metaconstant. (.name v1) (merge (.storage v1) (.storage v2))))
         bindings))

(defn- binding-map-with-data-fakes [fakes]
  (merge-metaconstant-bindings (data-fakes-to-metaconstant-bindings fakes)))

(defn binding-map [fakes]
  (let [[data-fakes function-fakes] (separate :data-fake fakes)]
    (merge (binding-map-with-function-fakes function-fakes)
           (binding-map-with-data-fakes data-fakes))))

(defmacro with-installed-fakes [fakes & forms]
  `(with-altered-roots (binding-map ~fakes) ~@forms))

;;; Checking

(defn fake-count [fake] (deref (:count-atom fake)))

(defmulti call-count-incorrect? :type)

(defmethod call-count-incorrect? :fake
  [fake]
  (let [method (or (:times fake) :default)
        count (fake-count fake)]
    (cond (= method :default)
          (zero? count)

          (number? method)
          (not= method count)

          (coll? method)
          (not (some #{count} method))

          (fn? method)
          (not (method count)))))

(defmethod call-count-incorrect? :not-called
  [fake]
  (not (zero? (fake-count fake))))

(defn check-call-counts [fakes]
  (doseq [fake fakes]
    (when (call-count-incorrect? fake)
      (report {:type :mock-incorrect-call-count
               :actual-count @(fake :count-atom)
               :expected-call (fake :call-text-for-failures)
               :position (:position fake)
               :expected (fake :call-text-for-failures)}))))



;; Folded prerequisites

;; Note that folded prerequisites are in semi-sweet-style. (That is, they can only

(defn unfold-fakes [form]
  (with-fresh-generated-metaconstant-names
    (translate-zipper form
      expect?
      unfold-expect-form__then__stay_put)))

