     [[:edit xy] :key-down 13]
     [[(display-mode xy)
       (display-mode (:source state))
-      [[:display xy] :value (get-in state [:cells (:focus state) :value])]]
+      [[:display xy] :value (cell-value (:focus state) state)]]
      (assoc state :mode :done)]
     
     :else [[] state]))

(defn string->token [s env]
  (or (ops s)
      (let [n (js/parseInt s)]
        (if (integer? n) n (resolve-var s env)))))

(defn parse-formula [s env]
  (let [[_ a b c] (string/split s #" ")]

(def source-mode  (cell-mode "source-mode"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The Brain

(defn behavior [message state]
  (println message state)
  (match message

    [[:display xy] :click _]
