             [cljs.core.async :refer (timeout <!)])
   (:require-macros [cljs.core.async.macros :refer (go)]))
 
-(defn add-timer
-  [f prefix]
-  (fn [& args]
-    (let [t (js/Date.)
-          r (apply f args)
-          t2 (js/Date.)]
-      (js/console.log prefix (- t2 t))
-      r)))
 
 (defn neighbors
   "Given a set of cells returns a seq of adjacent cells. If n cells share a 

          (hash-set)
          (frequencies (neighbors cells))))


(defn update-state
  [{:keys [cells bounds] :as state}] 
  (assoc state :cells (next-state cells bounds)))


#_(def update-state (add-timer update-state "update-state"))


(defn live!
  [app-state]
  (go 
    (while true

                        (cell-els width height cell-size cells)))))))

(defn draw!
  "Kick-off Om with the app-state atom"
  [app-state]
  (om/root world app-state {:target (. js/document (getElementById "app"))}))


(defonce app-state (atom {:cells #{} 
                          :bounds [50 20]
                          :playing? false 
                          :cell-size 20
                          :speed 5}))
(defn main []
  "Entry point for the application."
  (draw! app-state)
  (live! app-state))
