 (comment
   (deffact edge "[x] has an edge to [y]")
   (deffact connected "[x] is connected to [y]")
+
+  (def known&pretended [0 1])
 
   (let [plan empty-flow-plan
         [plan edges] (add-flow plan (FilterMap. known&pretended (fn [x] (when (= edge (.-shape x)) x))))

;; CLAUSES

(defrecord Recall [memory pattern]) ;; memory is one of :known :pretended :remembered :forgotten :known&pretended
(defrecord Filter [expr])
(defrecord Let [name expr])
(defrecord Set [name vars clauses])
(defrecord Output [memory pattern]) ;; memory is one of :pretended :remembered :forgotten
(defrecord OutputMany [memory expr]) ;; memory is one of :pretended :remembered :forgotten

(defn clause->flow-plan [flow-plan shape clause]
  (condp = (type clause)
    ;; TODO !!! keep going here
    ))

;; RULES

(defrecord Rule [clauses])

(defn rule->flow-plan [flow-plan rule]
  (loop [flow-plan flow-plan

    :remembered 2
    :forgotten 3))

(defn memory->nodes [memory]
  (case memory
    :known [0]
    :pretended [1]
    :remembered [2]
    :forgotten [3]
    :known&pretended [0 1]))

(def empty-flow-plan
  (FlowPlan. [(Union. #{}) (Union. #{}) (Union. #{}) (Union. #{})] {}))
