 
 ; Define the argmap
 (def argmap
-  {:error-function (make-mirror-image-error-function-from-cases (first mirror-image-train-and-test-cases)
-                                                                (second mirror-image-train-and-test-cases))
+  {:error-function mirror-image-error-function
    :atom-generators mirror-image-atom-generators
    :max-points 1200
    :max-genome-size-in-initial-program 150

                (= (first %) (vec (reverse (second %)))))
       inputs))

(defn make-mirror-image-error-function-from-cases
  [train-cases test-cases]
  (fn the-actual-mirror-image-error-function
    ([program]
      (the-actual-mirror-image-error-function program :train))
    ([program data-cases] ;; data-cases should be :train or :test
                          (the-actual-mirror-image-error-function program data-cases false))
    ([program data-cases print-outputs]
      (let [behavior (atom '())
            errors (doall
                     (for [[[input1 input2] correct-output] (case data-cases
                                                              :train train-cases
                                                              :test test-cases
                                                              [])]
                       (let [final-state (run-push program
                                                   (->> (make-push-state)
                                                     (push-item input2 :input)
                                                     (push-item input1 :input)))
                             result (top-item :boolean final-state)]
                         (when print-outputs
                           (println (format "Correct output: %5b | Program output: %s" correct-output (str result))))
                         ; Record the behavior
                         (when @global-print-behavioral-diversity
                           (swap! behavior conj result))
                         ; Error is boolean error
                         (if (= result correct-output)
                           0
                           1))))]
        (when @global-print-behavioral-diversity
          (swap! population-behaviors conj @behavior))
        errors))))

(defn get-mirror-image-train-and-test
  "Returns the train and test cases."
  [data-domains]

   :uniform-mutation-rate 0.01
   :problem-specific-report mirror-image-report
   :problem-specific-initial-report mirror-image-initial-report
   :report-simplifications 0
   :final-report-simplifications 5000
   :max-error 1
