           (cons [(- delay seconds) diff] (rest frames))))
       frames)))
 
-(defn elapsed-time-since [then]
-  (/ (- (.getTime (js/Date.)) (.getTime then)) 1000))
-
-(defn frames-at-speed [frames speed]
-  (map (fn [[delay diff]] [(/ delay speed) diff]) frames))
-
 (defn reset-blink [state]
   (assoc-in state [:cursor :on] true))
 

  (let [start (js/Date.)
        play-from (:play-from state)
        speed (:speed state)
        frames (-> (:frames state) (next-frames play-from) (frames-at-speed speed))
        diff-chan (coll->chan frames)
        timer-chan (coll->chan (repeat [0.3 true]))
        stop-playback-chan (chan)
        elapsed-time #(* (elapsed-time-since start) speed)

         :loop loop
         :speed speed}))

(defn elapsed-time-since [then]
  (/ (- (.getTime (js/Date.)) (.getTime then)) 1000))

(defn apply-diff [state {:keys [lines cursor]}]
  (merge-with merge state {:lines lines :cursor cursor}))

