 
 (comment
 
+  (.-kind->name->fields->index todomvc)
+  (index todomvc "todo-displayed")
+
   ;;Try to run todomvc and it blows up with "Can't split anything"
-  (do (defaults todomvc)
-    (fill-todos todomvc 5)
-    (re-run todomvc))
+  (perf-time
+   (do (defaults todomvc)
+     (init-std-lib todomvc)
+     (fill-todos todomvc 10)
+     (re-run todomvc)))
 
   ;;Trying to get the thing to run CRAZINESS, queued events cause re-run to be called
   ;;if I .quiesce the ui disappears, just calling .run is fine though


(defn fill-todos [env num]
  (dotimes [x num]
    (know env "todo" #js ["todo-id" "text"] #js [x (str "foo" x)]))
  (dotimes [x num]
    (know env "todo-editing" #js ["todo-id" "editing?"] #js [x "saved"]))
  (dotimes [x num]
    (know env "todo-completed" #js ["todo-id" "completed?"] #js [x "active"])))

(defn click! [env elem]
  (.assoc! (index env "ui/onClick") #js[elem] 0))

(let [program (env)]
  (rules program

;;          (rule draw-incr
;;                (when "incr" {:value value})
;;                (draw [:button {:id "incr" :events ["onClick"]} "increment: " 'value]))

;;          (rule clicked
;;                (when "ui/onClick" {:elem-id "incr"})
;;                (func 'new-val "value + 1")
;;                (change "incr" {:value 'value} {:value 'new-val}))

                      (rule this-is-awesome
                            (func 'cur "cur > -1 ? (cur < 10 ? cur + 1 : 10) : 0")
                            (remember "x-val" {:val 'x})
                            )

         )
  (let [compiled (compile program)]
