   (:require-macros [aurora.macros :refer [console-time set!! conj!! disj!! assoc!! apush apush* avec]]
                    [aurora.language :refer [deffact]]))
 
+;; TODO facts and plans need to be serializable
+
 ;; FACTS
-;; TODO facts need to be serialisable, can't depend on identity
 
 (defn- hash-array [array]
   (if (> (alength array) 0)

  ;; [y] is connected to [z]
  ;; + [x] is connected to [z]

  ;; TODO use filter-map in here to get the right shape
  (->
   (->
    (->FlowState #js [(transient #{}) nil nil (transient {}) (transient {}) nil nil]

        (aset node->update! node
              (condp = (type flow)
                Union (union-update!)
                FilterMap (filter-map-update! (:fun flow))
                Index (index-update! (:key-ixes flow))
                Lookup (lookup-update! (:index-node flow) (:key-ixes flow) (:val-ixes flow))))))
    (FlowState. node->state node->out-nodes node->facts node->update!)))
