   [app-state name]
   (let [{:keys [entities systems]} (deref app-state)
         {sys-fn :fn comp-ids :comp-ids} (systems name)        
-        valid-entity? (make-entity-validator comp-ids)        
+        valid-entity?     (make-entity-validator comp-ids)        
         matching-entities (filter valid-entity? entities)]
      (dorun
        (map
          (fn [[eid estate]] (sys-fn app-state eid estate))
          matching-entities))))
 
-
-(let (a "hello" b "whatever")
-
-(defn foo [{c :a d :b}]
-  )
-
-(run-system app-state :render)
-
-(def a 23)
-
-
-
-(let [a 42
-       (+ a 10)
-      a :foo]
-  b)+(defn movement-system
+  [app-state eid estate]
+  (let [{:keys [pos vel]} estate
+        pos' (mapv + pos vel)]
+    (swap! app-state assoc-in [:entities eid :pos] pos')))

(ns resonate2015.day1.ecs)

;; (component :position {:x 0 :y 10})

;; 1 [pos col vel renderable] ;; player
;; 2 [skill pos vel]

;; 1 {:pos {:x 1 :y 0} :color :red :renderable true}
;; 2 {:pos {:x ...} :vel {....}

;; color


(defn make-app
  []
  (atom
    {:uuid-counter 0
     :entities     {} 
     :systems      {}}))

(defn new-entity!
  "Defines a new entity ID"
