           value x]
      (if (empty? promotion-path)
        value
-       (let [[[k promoter] & r] promotion-path
+       (let [[v & r] promotion-path
+             k (:key v)
+             promoter (:promoter v)
              _ (assert (or (not check?)
                            (matches-arg-spec? k value)))
              next-value (promoter value)]

                    "There are several equally long paths to promote value"
                    {:value x
                     :paths (for [c candidates]
                              (let [c (persistent! c)]
                                (conj (mapv first c)
                                      arg-spec)))})))))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(spec/def ::promoter fn?)

(spec/def ::cost number?)
(spec/def ::promotion (spec/keys :req-un [::promoter ::cost]))

(spec/def ::promotions (spec/map-of ::key ::promotion))

(spec/def ::arg-spec (spec/keys :req-un [::pred
                                         ::pos
