(defn schedule* [state passes]
(let [free (filter (comp empty? :dependants) (vals passes))
w (first (group state))
non-looping-free (remove :affects free)]
(if (seq passes)
(let [{:keys [name] :as pass} (or (ffilter :compiler free)
(and w (or (first-walk w non-looping-free)
(first-walk :any non-looping-free)))
(first-walk :none free)
(maybe-looping-pass free passes))]
(recur (cons (assoc pass :passes [name]) state)
(remove-pass passes name)))
state)))