 (deftype FactShape [id madlib keys]
   Object
   (toString [this]
-            (apply str (interleave madlib (map (fn [k] (str "[" (name k) "]")) keys)))))
-
+            (apply str (interleave madlib (map (fn [k] (str "[" (name k) "]")) keys))))
+  IEquiv
+  (-equiv [this other]
+          (and (instance? FactShape other)
+               (= id (.-id other)))))
+
+;; if given a shape behaves like a record, otherwise behaves like a vector
 (deftype Fact [shape values ^:mutable __hash]
   Object
   (toString [this]

  (get x :b)


  (fact (fact-shape ::eg "[a] has a [b] with a [c]") #js ["a" "b" "c"])

  (= x x)

  (= x (fact (id->fact-shape ::eg) #js ["a" "b" "c"]))
  (= x (fact eg #js ["a" "b" "c"]))
  (= x (->eg "a" "b" "c"))
  (= (Fact. nil #js ["a" "b" "c"]) (Fact. nil #js ["a" "b" "c"]))

  (= x (Fact. nil #js ["a" "b" "c"]))
  (= x (Fact. eg #js ["a" "b" 0]))
  (= x (fact (fact-shape ::foo "[a] has a [b] with a [c]") #js ["a" "b" "c"]))

  (fact-ixes x #js [2 1])
  )
