       (doseq [[sma-old ss-buf] reborn-smasN]
         (ago-revive-state-machine ago-world sma-old ss-buf))
       ago-world))
-

(defn ago-return-chan [state value]
  (let [^not-native c (aget state ioc-helpers/USER-START-IDX)
        ago-world (chan-ago-world c)
        active? #(<= (compare-segvs (chan-segv c) (:segv @ago-world)) 0)]
    (when (active?)
      (when-not (nil? value)
        (protocols/put! c value (fn-handler active? (fn [] nil))))


(defn seqv+ [ago-world-now]
  (update-in ago-world-now [:seqv (dec (count (:seqv ago-world-now)))] inc))

(defn compare-segvs [segv-x segv-y]
  (loop [xs segv-x
         ys segv-y]
    (let [x (first xs)
          y (first ys)]
      (cond (= nil x y) 0
            (nil? x) 1 ; Normal compare handles length mismatches wrong.
            (nil? y) -1
            (= x y) (recur (rest xs) (rest ys))
            :else (- x y)))))

(defn segv-alive? [ago-world segv]
  (<= (compare-segvs segv (:segv @ago-world)) 0))

; --------------------------------------------------------

