 (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

  [[?e :todo/title]]
  =>
  (insert! [?e :todo/visible :tag]))
;(defrule todo-is-visible-when-filter-is-all
;  [:ui/visibility-filter [[e a v]] (= v :all)]
;  [:todo/title [[e a v]] (= ?e e)]
;  =>
;  (insert! [?e :todo/visible :tag]))
(def-tuple-rule todo-is-visile-when-filter-is-done-and-todo-done
  [[_ :ui/visibility-filter :done]]
  [[?e :todo/done]]
  =>
  (insert! [?e :todo/visible :tag]))

;(defrule todo-is-visible-when-filter-is-done-and-todo-done
;  [:ui/visibility-filter [[e a v]] (= v :done)]
;  [:todo/done [[e a v]] (= e ?e)]
;  =>
;  (insert! [?e :todo/visible :tag]))

;TODO. Currently returning full expr when detect op, need to parse rest as tuple
(def-tuple-rule todo-is-visible-when-filter-active-and-todo-not-done
  [[_ :ui/visibility-filter :active]]
  [[?e :todo/title]]

                                  clara-tups->maps]]
            [clara.rules.accumulators :as acc]
            [todomvc.tuplerules :refer-macros [def-tuple-session def-tuple-rule]]))

(defn todo-tx [id title done]
  (merge
