   (println "Retracting toggle-all-complete action: " ?toggle)
   (retract! ?toggle))
 
-;(defrule remove-toggle-complete-when-all-todos-done
-;  [?toggle <- :ui/toggle-complete]
-;  [?total <- (acc/count) :from [:todo/title]]
-;  [?total-done <- (acc/count) :from [:todo/done]]
-;  [:test (not (not (= ?total ?total-done)))]
-;  =>
-;  (println "Total todos: " ?total)
-;  (println "Total done: " ?total-done)
-;  (println "Retracting toggle-all-complete action: " ?toggle)
-;  (retract! ?toggle))
-
-; Need to nail down our accum syntax. Current expansion violates
-; Clara's schema anyway:
-;Value does not match schema: {:from {:constraints [(not ("s-expression" :all))]}}
 (def-tuple-rule no-done-todos-when-clear-completed-action
   [:exists [:ui/clear-completed]]
   [[?e :todo/title]]

(defquery find-done-count []
  [?count <- (acc/count) :from [:todo/done]])

;(defsession todos [print-all-facts]
;  :fact-type-fn (fn [[e a v]] a)
;  :ancestors-fn (fn [type] [:all]))

(def-tuple-session todos 'todomvc.rules)
;(def-tuple-session todos [todo-is-visible-when-filter-is-all])

;(def facts
;  (apply concat

  =>
  (insert! [?e :todo/visible :tag]))

(def-tuple-rule toggle-all-complete
  [:exists [:ui/toggle-complete]]
  [[?e :todo/title]]
  [:not [?e :todo/done]]
  =>
  (println "Marked done via toggle complete:" ?e)
  (insert-unconditional! [?e :todo/done :done]))

(def-tuple-rule remove-toggle-complete-when-all-todos-done
  [?toggle <- :ui/toggle-complete]
  [?total <- (acc/count) :from [:todo/title]]
