     (apply merge-with deep-merge vals)
     (last vals)))
 
-(println "test deep-merge" (deep-merge {:a 1} {:b {:c 2}}))
+(println "test deep-merge" (deep-merge {:a {:b 1}} {:a {:d 2}}))
 
 (defn entities-with-component
   "Takes a hashmap and returns all keys whose values contain component-id"

   component state which will be merged into the overall state"
  [state uid fns]
  (let [wrapped-fns (for [f fns] (mk-component-fn uid f))]
    (assoc state :components {uid {:fns fns :state {}}})))

(println "test mk-component"
         (mk-component {} :my-component [identity]))

   merged into the game state."
  [component-id f]
  (fn [state entity-id]
    (let [r (mk-component-state
             component-id
             entity-id
             (f (get-component-state state component-id entity-id)
                entity-id))]
      (println "component-fn result" r)
      r)))

(println "test mk-component-fn"
         ((mk-component-fn :test (fn [& args] (identity {:foo "bar"})))
