                                                                                              #js ["make-str" "constant" "js" "\"edge \" + xx + \" \" + yy"]
                                                                                              #js ["know-str" "variable" "name" "zz"]])
 
-(def rule-id->flow (compile kn))
-
-rule-id->flow
-
-(.run (aget rule-id->flow "single-edge") kn)
+(def flows (compile kn))
+
+(set! (.-rules flows) #js ["single-edge" "transitive-edge" "function-edge"])
+
+(enable-console-print!)
+
+(.run flows kn)
 
 (.get-or-create-index kn "know" "connected" #js ["x" "y"])
 
-(.run (aget rule-id->flow "transitive-edge") kn)
-
-(.get-or-create-index kn "know" "connected" #js ["x" "y"])
-
-(.run (aget rule-id->flow "transitive-edge") kn)
-
-(.get-or-create-index kn "know" "connected" #js ["x" "y"])
-
-(.run (aget rule-id->flow "transitive-edge") kn)
-
-(.get-or-create-index kn "know" "connected" #js ["x" "y"])
-
-(.run (aget rule-id->flow "function-edge") kn)
-
 (.get-or-create-index kn "know" "str-edge" #js ["name"])


          ;; ensure at least one index per output
          (dotimes [i (alength output-kinds)]
            (.get-or-create-index kn (aget output-kinds i) (aget output-names i) (into-array (filter #(not (nil? %)) (aget output-fields i)))))

          (aset rule-id->flow rule-id
                (Flow. solver output-kinds output-names output-fields)))))

    rule-id->flow))

;; TESTS


        (set!! changed? true)))
    changed?))

(deftype Knowledge [^:mutable kind->name->fields->index]
  Object
  (get-or-create-index [this kind name fields]
                       (assert (or (= kind "know") (= kind "remember") (= kind "forget")) (pr-str kind))
