   otherwise."
   (fn [one-track-input]
     (let [results ((apply juxt switch-fns) one-track-input)
-          failures (filter (comp nil? first) results)]
+          failures (filter failed? results)]
       (if (empty? failures)
-        (succeed (apply merge-success (core-map first results)))
-        (fail (apply merge-failure (core-map second failures)))))))
+        (succeed (apply merge-success (core-map get-success results)))
+        (fail (apply merge-failure (core-map get-failure failures)))))))
 

  This Source Code Form is subject to the terms of the Mozilla Public
  License, v. 2.0. If a copy of the MPL was not distributed with this
  file, You can obtain one at http://mozilla.org/MPL/2.0/."
  (:refer-clojure :rename {map core-map}))

(defmulti execute (fn [[value] _] value))
(defmethod execute nil [two-track-input _] two-track-input)
(defmethod execute :default [[value] switch-fn] (switch-fn value))

(defn succeed
  "Creates a two-track result by placing the value on the success

  "An adapter that takes two one-track functions and turns them into
  a single two-track function."
  [success-fn failure-fn]
  (fn [two-track-input]
    (if (succeeded? two-track-input)
      (-> two-track-input get-success success-fn succeed)
      (-> two-track-input get-failure failure-fn fail))))

(defn plus [merge-success merge-failure & switch-fns]
  "Returns a function that executes all switch-fns in parrallel and
