           [(zip/node p) :end]))))
 
 (defn output-node->dependency-map
+  "Takes a signal and returns a map of signals to sets of signal dependencies."
   [output-node]
   (loop [deps {}
          loc (node-graph-zipper output-node)]

               (zip/next loc))))))

(defn topsort
  [output]
  (-> output
      output-node->dependency-map

                                              (->Fresh (:value msg))))}}))

(defn drop-if
  "Like `keep-if`, but drops values which match the predicate."
  [pred base sig]
  (keep-if (complement pred) base sig))

(defn keep-when
  "Returns a new signal which relays values from `value-sig`, but only when the current
  value of `switch-sig` is truthy."
  [switch-sig base value-sig]
  (->> value-sig
       (map vector (sample-on value-sig switch-sig))
